Prep fMRI data for connectivity or computational model-based anlayses

Below is a step‐by‐step tutorial for pre‐processing fMRI data for connectivity analyses and custom linear or computational reinforcement learning (RL) models using CANLAB tools. In this example, we create a denoised 4-D time series (an fmri_data object) for each participant, then use it for downstream analyses. The CANLAB toolboxes (see CANLAB.github.io) offer functions for most of these steps. Feel free to adapt the code snippets to your specific dataset and analysis goals.
See also:
https://canlab.github.io/_pages/tutorials/html/nuisance_covariates.html
canlab_connectivity_preproc()
Table of Contents
% Some formatting stuff for html
set(groot, 'DefaultFigurePosition', [200, 200, 900, 600], 'DefaultAxesFontSize', 12);

Pipeline for denoising multi-run 4-D time series image data

denoise_timeseries_pipeline prepares 4-D time series images from a participant for connectivity or model-based analysis.
See also canlab_connectivity_preproc
% Load the key 4-D image file into an object:
fname = which('swrsub-sid001567_task-pinel_acq-s1p2_run-03_bold.nii.gz');
obj = fmri_data(fname);
Using default mask: /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 145720800 bytes Loading image number: 150 Elapsed time is 0.455582 seconds. Image names entered, but fullpath attribute is empty. Getting path info. .fullpath should have image name for each image column in .dat Attempting to expand image filenames in case image list is unexpanded 4-D images Number of unique values in dataset: 493 Bit rate: 8.95 bits Warning: Number of unique values in dataset is low, indicating possible restriction of bit rate. For comparison, Int16 has 65,536 unique values
 
% Get the TR from the JSON file:
json_struct = jsondecode(fileread(which('sub-sid001567_task-pinel_acq-s1p2_run-03_bold.json')));
TR = json_struct.RepetitionTime;
 
% Specify the movement parameter file:
mvmtfname = which('rp_sub-sid001567_task-pinel_acq-s1p2_run-03_bold.txt');
 
% Run the denoising pipeline:
obj_denoised = obj.denoise_timeseries_pipeline(TR, 128, mvmtfname, 'plot', true, 'verbose', true);
Starting denoise_timeseries_pipeline Loading movement regressors... Computing outlier regressors... ______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | rmssd | Missing values | 0 images Retained 2 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 18.67% Expected 7.50 outside 95% ellipsoid, found 6 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 1 Uncorrected: 6 images Cases 1 2 3 4 5 6 Retained 2 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 22.67% Expected 7.50 outside 95% ellipsoid, found 6 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 1 Uncorrected: 6 images Cases 1 2 3 4 5 6 Mahalanobis (cov and corr, q<0.05 corrected): 1 images Framewise Displacement (before and after >0.50 mm correction): 0 images Outlier_count Percentage _____________ __________ global_mean 6 4 global_mean_to_variance 4 2.6667 missing_values 0 0 rmssd_dvars 1 0.66667 spatial_variability 4 2.6667 mahal_cov_uncor 6 4 mahal_cov_corrected 1 0.66667 mahal_corr_uncor 6 4 mahal_corr_corrected 1 0.66667 fd 0 0 Overall_uncorrected 10 6.6667 Overall_corrected 8 5.3333 Number of outlier volumes (uncorrected): 10 Extracting mean CSF signal... Extracting from gray_matter_mask_sparse.img. Removing 2565 voxels with one or more NaNs Extracting from canonical_white_matter.img. Removing 106 voxels with one or more NaNs Extracting from canonical_ventricles.img. Removing 158 voxels with one or more NaNs Applying high-pass filter...
Regressing out nuisance covariates... Denoised metadata table: mvmt_x mvmt_y mvmt_z mvmt_roll mvmt_pitch mvmt_yaw mvmt_x^2 mvmt_y^2 mvmt_z^2 mvmt_roll^2 mvmt_pitch^2 mvmt_yaw^2 mvmt_xdiff mvmt_ydiff mvmt_zdiff mvmt_rolldiff mvmt_pitchdiff mvmt_yawdiff mvmt_xdiff^2 mvmt_ydiff^2 mvmt_zdiff^2 mvmt_rolldiff^2 mvmt_pitchdiff^2 mvmt_yawdiff^2 Out1 Out2 Out3 Out4 Out5 Out6 Out7 Out8 Out9 Out10 MeanCSF KH1 KH2 KH3 KH4 _________ __________ __________ _________ ___________ _________ __________ __________ __________ ___________ ____________ __________ ___________ __________ ___________ _____________ ______________ ____________ ____________ ____________ ____________ _______________ ________________ ______________ ____ ____ ____ ____ ____ ____ ____ ____ ____ _____ _______ __________ ___________ _________ __________ -0.15734 -1.1991 3.2993 1.2974 -1.8213 -1.0474 0.024756 1.4379 10.885 1.6833 3.3172 1.0971 0 0 0 0 0 0 0.0058857 1.0776e-05 0.007354 0.0094301 0.00028598 0.015048 1 0 0 0 0 0 0 0 0 0 303.4 0.11546 0.11544 0.11541 0.11537 -0.49252 -1.3582 3.8513 1.2745 -2.8581 -1.2734 0.24258 1.8448 14.833 1.6242 8.1685 1.6215 -0.33518 -0.1591 0.55207 -0.022944 -1.0367 -0.22597 6.5524 0.0095731 3.1375 0.00065022 9.3308 4.3304 0 1 0 0 0 0 0 0 0 0 305.27 0.11541 0.11524 0.11496 0.11456 -1.3909 -0.76668 3.8426 1.1925 -4.3719 -1.9456 1.9346 0.5878 14.766 1.4221 19.113 3.7852 -0.89839 0.59156 -0.0087285 -0.081951 -1.5138 -0.67218 45.321 0.12131 0.0034935 0.11616 19.824 35.378 0 0 1 0 0 0 0 0 0 0 304.56 0.11531 0.11484 0.11405 0.11295 -1.6729 -0.44907 3.6899 1.0493 -4.1512 -1.9579 2.7984 0.20166 13.615 1.101 17.232 3.8335 -0.28194 0.31762 -0.15272 -0.14324 0.22069 -0.012385 4.6889 0.034405 0.1448 0.44666 0.39654 0.052901 0 0 0 1 0 0 0 0 0 0 305.13 0.11516 0.11423 0.11269 0.11054 -1.7716 1.2247 3.4342 1.0013 -3.4948 -2.1775 3.1384 1.4999 11.794 1.0026 12.214 4.7416 -0.098712 1.6738 -0.25568 -0.047956 0.6564 -0.21958 0.65285 0.98306 0.48284 0.025333 3.6342 4.1031 0 0 0 0 1 0 0 0 0 0 305.5 0.11496 0.11342 0.11089 0.10736 -2.1816 -1.7807 2.781 1.6438 -2.9914 -2.4684 4.7593 3.171 7.7338 2.7022 8.9483 6.0932 -0.41002 -3.0054 -0.65323 0.64251 0.50342 -0.29092 9.6982 3.2023 3.643 12.465 2.1261 6.99 0 0 0 0 0 1 0 0 0 0 306.53 0.1147 0.11242 0.10864 0.10343 -2.2071 0.19207 2.381 1.6966 -2.1391 -2.3392 4.8713 0.036893 5.6693 2.8784 4.576 5.4721 -0.025525 1.9728 -0.39994 0.05275 0.85223 0.1292 0.070657 1.367 1.2889 0.14364 6.1512 0.99405 0 0 0 0 0 0 1 0 0 0 307.61 0.1144 0.11122 0.10597 0.098769 -1.9208 -0.25819 1.8876 1.8703 -1.5973 -2.0534 3.6895 0.066663 3.5629 3.4981 2.5513 4.2163 0.2863 -0.45027 -0.49348 0.17375 0.54187 0.28588 4.1788 0.073381 2.019 1.0519 2.4674 5.5452 0 0 0 0 0 0 0 1 0 0 307.45 0.11405 0.10982 0.10288 0.093417 -1.6532 0.10572 1.2791 1.9866 -0.30261 -1.6557 2.7331 0.011178 1.636 3.9464 0.091573 2.7412 0.26762 0.36392 -0.6085 0.11624 1.2947 0.39769 3.6321 0.04537 3.1403 0.51589 14.262 11.048 0 0 0 0 0 0 0 0 1 0 308.45 0.11365 0.10823 0.09939 0.08741 -1.39 0.76089 0.58947 1.9495 -0.21464 -1.5776 1.9322 0.57896 0.34748 3.8006 0.04607 2.4889 0.26315 0.65517 -0.68958 -0.037044 0.087971 0.078032 3.5071 0.14908 4.079 0.010171 0.058009 0.30644 0 0 0 0 0 0 0 0 0 0 307.55 0.11319 0.10645 0.095503 0.08079 -1.4473 -1.0571 1.0689 2.061 -0.022412 -1.504 2.0947 1.1174 1.1425 4.2477 0.00050229 2.2621 -0.057266 -1.818 0.47942 0.11148 0.19223 0.073628 0.25095 1.1745 2.4009 0.48005 0.29847 0.26565 0 0 0 0 0 0 0 0 0 0 307.8 0.11269 0.10448 0.091239 0.073603 -1.4445 -0.051963 0.81845 1.8435 -0.26366 -1.6727 2.0865 0.0027002 0.66986 3.3986 0.069518 2.7978 0.0028397 1.0051 -0.25044 -0.21746 -0.24125 -0.16865 0.0031005 0.35293 0.46087 1.1342 0.52387 2.5099 0 0 0 0 0 0 0 0 0 0 307.51 0.11214 0.10233 0.086615 0.0659 -1.4448 -1.6969 1.1674 1.9769 -0.16715 -1.5592 2.0875 2.8796 1.3629 3.908 0.02794 2.4312 -0.00033265 -1.645 0.349 0.13334 0.09651 0.11345 0.0062699 0.96225 1.3255 0.65556 0.070687 0.74049 0 0 0 0 0 0 0 0 0 0 307.28 0.11154 0.1 0.08165 0.057735 -1.0211 0.43626 1.0126 1.8334 -0.039812 -1.3648 1.0427 0.19032 1.0254 3.3612 0.001585 1.8628 0.42368 2.1332 -0.1548 -0.14352 0.12734 0.19438 9.3757 1.5991 0.14968 0.44869 0.12688 2.4393 0 0 0 0 0 0 0 0 0 0 307.66 0.11089 0.097495 0.076362 0.049165 -1.0815 -1.518 0.8008 1.9916 -0.24335 -1.322 1.1697 2.3043 0.64128 3.9665 0.05922 1.7478 -0.060411 -1.9542 -0.21184 0.15824 -0.20354 0.042803 0.27484 1.3566 0.31476 0.88871 0.37613 0.061639 0 0 0 0 0 0 0 0 0 0 307.87 0.11019 0.094818 0.070772 0.04025 -0.94266 0.20214 0.82532 1.7012 -0.17976 -1.3006 0.88861 0.040862 0.68115 2.8941 0.032312 1.6915 0.13887 1.7201 0.024518 -0.2904 0.063597 0.021473 0.90639 1.0385 0.025796 2.1164 0.028707 0.0040218 0 0 0 0 0 0 0 0 0 0 307.28 0.10944 0.091975 0.064904 0.031052 -1.0518 -2.3648 0.93155 1.7947 -0.51561 -1.3457 1.1063 5.5924 0.86778 3.2208 0.26585 1.8109 -0.10913 -2.567 0.10623 0.093474 -0.33585 -0.045133 0.7835 2.3376 0.16818 0.35595 1.0019 0.264 0 0 0 0 0 0 0 0 0 0 308.11 0.10864 0.088971 0.058779 0.021637 -0.97934 0.14658 0.70868 1.5625 -0.27504 -1.3965 0.95911 0.021487 0.50223 2.4415 0.075644 1.9502 0.072447 2.5114 -0.22287 -0.23213 0.24057 -0.050806 0.21158 2.2181 0.35366 1.3072 0.47331 0.31693 0 0 0 0 0 0 0 0 0 0 307.75 0.1078 0.085811 0.052422 0.01207 -1.1525 -1.7327 0.86596 1.7382 -0.12218 -1.3544 1.3283 3.0023 0.74989 3.0214 0.014927 1.8343 -0.17316 -1.8793 0.15728 0.17569 0.15286 0.042151 1.8482 1.2548 0.3203 1.0732 0.18574 0.058864 0 0 0 0 0 0 0 0 0 0 308.63 0.10691 0.0825 0.045859 0.0024182 -0.97037 1.1189 0.92381 1.1774 0.024774 -1.3963 0.94162 1.252 0.85342 1.3862 0.00061376 1.9498 0.18213 2.8516 0.057843 -0.56087 0.14695 -0.041991 1.6193 2.8613 0.068833 8.4107 0.17111 0.23676 0 0 0 0 0 0 0 0 0 0 307.78 0.10597 0.079045 0.039114 -0.0072504 -1.0712 -1.7873 1.239 1.4587 0.022359 -1.3257 1.1475 3.1946 1.5351 2.1277 0.00049993 1.7575 -0.10086 -2.9063 0.31519 0.28131 -0.002415 0.070653 0.6788 2.9949 1.0985 2.5613 0.00057538 0.23974 0 0 0 0 0 0 0 0 0 0 307.28 0.10499 0.075451 0.032215 -0.016868 -1.0441 0.30213 1.1084 1.1174 0.22826 -1.3538 1.0901 0.091285 1.2287 1.2486 0.052104 1.8328 0.027158 2.0895 -0.13055 -0.34126 0.2059 -0.02811 0.015492 1.534 0.097867 2.9808 0.34386 0.13416 0 0 0 0 0 0 0 0 0 0 307.24 0.10396 0.071724 0.025189 -0.026368 -1.0828 -1.3647 1.0829 1.2542 -0.12194 -1.3504 1.1724 1.8624 1.1726 1.573 0.01487 1.8237 -0.038723 -1.6668 -0.02557 0.13679 -0.35021 0.0033691 0.13219 0.98791 5.9081e-05 0.68577 1.0879 0.0087372 0 0 0 0 0 0 0 0 0 0 307.14 0.10288 0.067872 0.018063 -0.035682 -1.0344 0.99192 1.3479 0.79244 0.8439 -1.4029 1.07 0.9839 1.8168 0.62796 0.71217 1.9682 0.048405 2.3566 0.26501 -0.46176 0.96585 -0.052494 0.079453 1.9525 0.80082 5.6191 7.9134 0.33362 0 0 0 0 0 0 0 0 0 0 307.24 0.10176 0.0639 0.010867 -0.044746 -1.0897 -0.3552 1.3966 0.64228 0.84837 -1.485 1.1874 0.12617 1.9504 0.41253 0.71973 2.2053 -0.05528 -1.3471 0.048677 -0.15016 0.0044668 -0.082084 0.23643 0.64628 0.054931 0.49748 1.4617e-05 0.69561 0 0 0 0 0 0 0 0 0 0 306.88 0.1006 0.059817 0.003627 -0.053497 -1.2111 0.26729 1.4066 0.4079 0.90869 -1.5302 1.4669 0.071444 1.9786 0.16638 0.82571 2.3415 -0.12147 0.62249 0.010055 -0.23439 0.060321 -0.045198 0.95369 0.13446 0.013562 1.335 0.025546 0.26457 0 0 0 0 0 0 0 0 0 0 307.63 0.09939 0.055628 -0.003627 -0.061872 -1.3604 -0.97276 1.1072 0.5413 0.43431 -1.567 1.8508 0.94626 1.2259 0.29301 0.18862 2.4555 -0.14931 -1.24 -0.2994 0.13341 -0.47438 -0.036797 1.399 0.54802 0.68619 0.65613 1.9793 0.19498 0 0 0 0 0 0 0 0 0 0 307.73 0.098137 0.051342 -0.010867 -0.069813 -1.398 -0.42457 1.1664 0.69572 0.3385 -1.4761 1.9543 0.18026 1.3606 0.48403 0.11458 2.179 -0.037517 0.54819 0.059217 0.15442 -0.095812 0.090856 0.12578 0.10402 0.071052 0.85062 0.088593 0.44184 0 0 0 0 0 0 0 0 0 0 307.01 0.096841 0.046966 -0.018063 -0.077265 -1.4148 -0.0066345 0.76341 0.66975 0.63005 -1.4656 2.0017 4.4017e-05 0.58279 0.44857 0.39696 2.1479 -0.016842 0.41794 -0.40303 -0.025969 0.29155 0.010583 0.040596 0.060079 1.3105 0.0017361 0.70115 0.00095826 0 0 0 0 0 0 0 0 0 0 307.67 0.095503 0.042507 -0.025189 -0.084174 -1.387 -1.6263 1.1817 0.80755 0.55166 -1.4178 1.9239 2.6447 1.3963 0.65213 0.30433 2.0101 0.027776 -1.6196 0.41825 0.1378 -0.078385 0.047793 0.016653 0.93291 1.8571 0.69467 0.060803 0.084979 0 0 0 0 0 0 0 0 0 0 306.76 0.094123 0.037974 -0.032215 -0.090493 -1.249 0.87037 0.41101 0.80719 0.67147 -1.3424 1.5601 0.75755 0.16893 0.65155 0.45088 1.802 0.13798 2.4966 -0.77065 -0.00035897 0.11981 0.075378 0.89393 2.192 5.14 0.0090612 0.11165 0.28151 0 0 0 0 0 0 0 0 0 0 307.44 0.092701 0.033375 -0.039114 -0.096177 -1.1904 -1.9713 0.67685 1.0462 0.44651 -1.1468 1.417 3.886 0.45813 1.0946 0.19937 1.3152 0.05867 -2.8417 0.26584 0.23906 -0.22497 0.19558 0.1281 2.8634 0.80535 1.8895 0.45709 2.4722 0 0 0 0 0 0 0 0 0 0 306.71 0.091239 0.028716 -0.045859 -0.10119 -1.105 -0.062535 0.5536 0.97036 0.86203 -0.98977 1.2211 0.0039107 0.30647 0.94159 0.7431 0.97965 0.085352 1.9088 -0.12326 -0.075887 0.41553 0.15704 0.30866 1.2795 0.084428 0.095122 1.4415 1.5333 0 0 0 0 0 0 0 0 0 0 307.1 0.089737 0.024008 -0.052422 -0.10549 -1.1165 -0.60988 0.30825 1.0095 0.85507 -0.96074 1.2465 0.37195 0.095019 1.0191 0.73114 0.92302 -0.011426 -0.54734 -0.24535 0.039133 -0.0069696 0.029033 0.026039 0.10797 0.44001 0.093778 0.0013937 0.016626 0 0 0 0 0 0 0 0 0 0 307.13 0.088196 0.019257 -0.058779 -0.10905 -1.23 -0.18675 0.31138 0.92682 0.90326 -0.99525 1.5128 0.034875 0.096954 0.859 0.81588 0.99053 -0.1135 0.42313 0.003124 -0.082671 0.048198 -0.034512 0.84189 0.061601 0.0090809 0.1188 0.015453 0.17788 0 0 0 0 0 0 0 0 0 0 307.35 0.086615 0.014472 -0.064904 -0.11184 -1.1763 -0.84705 0.078989 0.92369 1.0509 -0.94595 1.3837 0.71749 0.0062392 0.8532 1.1045 0.89483 0.053656 -0.6603 -0.23239 -0.0031319 0.14767 0.049301 0.1029 0.15659 0.38908 0.0064597 0.17286 0.092772 0 0 0 0 0 0 0 0 0 0 307.59 0.084997 0.0096623 -0.070772 -0.11385 -1.1502 -0.80739 0.42295 0.96333 0.90221 -0.94073 1.3229 0.65188 0.17889 0.92801 0.81399 0.88497 0.026108 0.039659 0.34396 0.039646 -0.14872 0.005224 0.013618 0.00041161 1.2903 0.095465 0.2049 0.0059905 0 0 0 0 0 0 0 0 0 0 307.03 0.083342 0.0048354 -0.076362 -0.11507 -1.0346 -1.224 0.42202 0.93129 0.86272 -0.80244 1.0703 1.4983 0.1781 0.86729 0.74429 0.64391 0.11563 -0.41666 -0.00092699 -0.032048 -0.039489 0.13829 0.60823 0.062958 0.0068766 0.0054987 0.017587 1.1573 0 0 0 0 0 0 0 0 0 0 307.8 0.08165 7.0705e-18 -0.08165 -0.11547 -0.96938 -0.81165 0.02609 0.81037 0.92353 -0.7952 0.93969 0.65878 0.00068067 0.6567 0.85291 0.63234 0.065182 0.41239 -0.39593 -0.12091 0.060807 0.007241 0.16497 0.058475 1.2613 0.30144 0.026004 0.0035902 0 0 0 0 0 0 0 0 0 0 307.37 0.079922 -0.0048354 -0.086615 -0.11507 -0.9768 0.0040614 0.17422 0.80549 0.98448 -0.78146 0.95414 1.6495e-05 0.030352 0.64881 0.96921 0.61069 -0.0074249 0.81571 0.14813 -0.0048857 0.060954 0.013732 0.017351 0.23186 0.28946 0.0050411 0.026143 1.3407e-05 0 0 0 0 0 0 0 0 0 0 307.42 0.078159 -0.0096623 -0.091239 -0.11385 -1.006 -0.94299 -0.23501 1.1474 1.318 -0.74509 1.0119 0.88922 0.05523 1.3166 1.7372 0.55517 -0.029152 -0.94705 -0.40923 0.34193 0.33353 0.03637 0.085663 0.32052 1.3542 3.703 0.92229 0.037065 0 0 0 0 0 0 0 0 0 0 307.91 0.076362 -0.014472 -0.095503 -0.11184 -1.0515 -0.61137 0.1002 0.89017 1.1292 -0.69527 1.1056 0.37378 0.01004 0.7924 1.2752 0.4834 -0.045506 0.33161 0.33521 -0.25724 -0.18878 0.049828 0.17126 0.037561 1.2304 1.6322 0.32494 0.095575 0 0 0 0 0 0 0 0 0 0 306.66 0.074531 -0.019257 -0.09939 -0.10905 -0.97589 -0.88058 -0.27552 0.93828 1.181 -0.67632 0.95237 0.77542 0.075913 0.88038 1.3947 0.4574 0.075565 -0.26921 -0.37573 0.048114 0.051717 0.018951 0.23336 0.02666 1.1266 0.12547 0.018123 0.0017273 0 0 0 0 0 0 0 0 0 0 306.75 0.072668 -0.024008 -0.10288 -0.10549 -0.9492 -0.23123 -0.15481 0.835 1.3329 -0.62819 0.90098 0.053466 0.023965 0.69722 1.7767 0.39462 0.026694 0.64935 0.12072 -0.10329 0.15197 0.048129 0.014649 0.14642 0.20641 0.20689 0.1835 0.086687 0 0 0 0 0 0 0 0 0 0 306.5 0.070772 -0.028716 -0.10597 -0.10119 -0.85821 -0.71335 -0.37084 1.0357 1.4401 -0.5881 0.73652 0.50886 0.13752 1.0728 2.074 0.34586 0.090995 -0.48212 -0.21603 0.20075 0.10719 0.040089 0.35686 0.083996 0.32927 1.3687 0.088313 0.050513 0 0 0 0 0 0 0 0 0 0 306.87 0.068846 -0.033375 -0.10864 -0.096177 -0.47654 0.26054 -0.29883 0.91243 1.3659 -0.36521 0.22709 0.067881 0.089298 0.83253 1.8657 0.13338 0.38166 0.97388 0.072008 -0.12331 -0.074221 0.22289 7.5662 0.33123 0.093397 0.31569 0.054935 3.2723 0 0 0 0 0 0 0 0 0 0 306.91 0.06689 -0.037974 -0.11089 -0.090493 -0.70652 -1.7602 -0.3775 0.83136 1.0722 -0.31127 0.49918 3.0984 0.14251 0.69116 1.1496 0.096886 -0.22998 -2.0208 -0.078675 -0.081073 -0.29372 0.053943 3.1699 1.4503 0.023856 0.11299 0.77007 0.1189 0 0 0 0 0 0 0 0 0 0 307.53 0.064904 -0.042507 -0.11269 -0.084174 -0.76104 1.1148 -0.73015 0.70771 1.6592 -0.39643 0.57919 1.2428 0.53312 0.50085 2.7531 0.15716 -0.054519 2.875 -0.35264 -0.12365 0.58706 -0.085163 0.23098 2.9085 0.98194 0.31774 2.9009 0.74083 0 0 0 0 0 0 0 0 0 0 307.24 0.062889 -0.046966 -0.11405 -0.077265 -0.7281 -1.6329 -0.48562 0.81473 1.2132 -0.36018 0.53013 2.6665 0.23583 0.66378 1.4718 0.12973 0.032941 -2.7477 0.24453 0.10702 -0.44606 0.036246 0.027994 2.6776 0.69279 0.44757 1.7527 0.036651 0 0 0 0 0 0 0 0 0 0 307.18 0.060848 -0.051342 -0.11496 -0.069813 -0.79829 -0.72981 -0.35515 0.85793 1.2536 -0.34495 0.63727 0.53263 0.12613 0.73605 1.5716 0.11899 -0.070189 0.90312 0.13047 0.043208 0.040447 0.015231 0.35604 0.28459 0.23437 0.10759 0.010323 8.6929e-05 0 0 0 0 0 0 0 0 0 0 307.17 0.058779 -0.055628 -0.11541 -0.061872 -0.76955 0.85101 -0.57952 0.51123 1.1874 -0.41825 0.59221 0.72422 0.33585 0.26136 1.4099 0.17493 0.028736 1.5808 -0.22438 -0.3467 -0.066216 -0.0733 0.01854 0.87656 0.35917 3.0822 0.044491 0.57442 0 0 0 0 0 0 0 0 0 0 307.21 0.056685 -0.059817 -0.11541 -0.053497 -0.80758 -1.4416 -0.18698 0.59822 0.69273 -0.36157 0.65218 2.0783 0.03496 0.35786 0.47988 0.13073 -0.038021 -2.2926 0.39255 0.086982 -0.49468 0.05668 0.12844 1.8656 1.6493 0.31577 2.1502 0.13582 0 0 0 0 0 0 0 0 0 0 306.77 0.054565 -0.0639 -0.11496 -0.044746 -0.73243 1.0213 -0.25284 0.29842 0.71589 -0.43154 0.53645 1.043 0.063929 0.089056 0.5125 0.18622 0.075148 2.4629 -0.065865 -0.29979 0.023161 -0.069963 0.23038 2.133 0.013304 2.2648 0.002596 0.53143 0 0 0 0 0 0 0 0 0 0 306.37 0.052422 -0.067872 -0.11405 -0.035682 -0.82717 -1.2096 -0.37657 0.54444 0.5031 -0.37222 0.68421 1.4632 0.1418 0.29641 0.25311 0.13855 -0.09474 -2.2309 -0.12372 0.24601 -0.21279 0.059315 0.60616 1.7667 0.085261 1.9931 0.4101 0.15317 0 0 0 0 0 0 0 0 0 0 306.77 0.050256 -0.071724 -0.11269 -0.026368 -0.76184 0.15589 -0.38516 0.49532 0.78368 -0.34296 0.5804 0.0243 0.14835 0.24535 0.61415 0.11762 0.065331 1.3655 -0.0085929 -0.049113 0.28057 0.02926 0.16586 0.65331 0.0035426 0.027339 0.64831 0.017137 0 0 0 0 0 0 0 0 0 0 306.8 0.048068 -0.075451 -0.11089 -0.016868 -0.77251 -0.77527 -0.60201 0.57432 0.79743 -0.33386 0.59677 0.60105 0.36242 0.32985 0.63589 0.11146 -0.010669 -0.93116 -0.21685 0.079001 0.013754 0.0091028 0.02426 0.30991 0.33215 0.26965 0.00054701 0.0019169 0 0 0 0 0 0 0 0 0 0 307.48 0.045859 -0.079045 -0.10864 -0.0072504 -0.74281 0.93151 -0.30542 0.5179 0.82324 -0.35874 0.55177 0.8677 0.093281 0.26823 0.67772 0.12869 0.029695 1.7068 0.29659 -0.05642 0.025811 -0.02488 0.020524 1.0223 0.98267 0.041777 0.0034478 0.11444 0 0 0 0 0 0 0 0 0 0 307.24 0.043629 -0.0825 -0.10597 0.0024182 -0.61512 0.72698 -0.48487 0.5513 0.55014 -0.33526 0.37837 0.5285 0.2351 0.30394 0.30265 0.1124 0.12769 -0.20453 -0.17945 0.0334 -0.27311 0.023478 0.7556 0.015585 0.21357 0.075953 0.66769 0.0065274 0 0 0 0 0 0 0 0 0 0 307.47 0.041381 -0.085811 -0.10288 0.01207 -0.72917 -0.53763 -0.18166 0.53842 0.3592 -0.30413 0.53169 0.28904 0.033 0.2899 0.12902 0.092493 -0.11405 -1.2646 0.30321 -0.012885 -0.19094 0.031132 0.84944 0.56983 1.0232 0.00079828 0.3322 0.021647 0 0 0 0 0 0 0 0 0 0 306.88 0.039114 -0.088971 -0.09939 0.021637 -0.68023 -0.036311 -0.46808 0.17264 0.49954 -0.29022 0.46271 0.0013185 0.2191 0.029804 0.24954 0.084226 0.048945 0.50131 -0.28642 -0.36578 0.14034 0.01391 0.081722 0.086827 0.6221 3.4506 0.15547 4.5039e-06 0 0 0 0 0 0 0 0 0 0 306.38 0.03683 -0.091975 -0.095503 0.031052 -0.59846 -0.27568 -0.14558 0.1484 0.35063 -0.26457 0.35816 0.075999 0.021193 0.022023 0.12294 0.069999 0.081763 -0.23937 0.3225 -0.024238 -0.14891 0.025644 0.27983 0.021184 1.1458 0.0010509 0.20542 0.0099131 0 0 0 0 0 0 0 0 0 0 306.84 0.03453 -0.094818 -0.091239 0.04025 -0.50031 -0.58355 -0.54421 0.18995 0.38563 -0.22153 0.25031 0.34053 0.29616 0.036081 0.14871 0.049075 0.098152 -0.30787 -0.39863 0.04155 0.035006 0.043046 0.42302 0.034693 1.2799 0.10185 0.0073374 0.062688 0 0 0 0 0 0 0 0 0 0 308 0.032215 -0.097495 -0.086615 0.049165 -0.33949 1.175 -0.67943 0.22554 0.42684 -0.14622 0.11525 1.3807 0.46163 0.050869 0.18219 0.021381 0.16082 1.7586 -0.13523 0.035591 0.041206 0.075307 1.2425 1.0856 0.107 0.082542 0.01078 0.28086 0 0 0 0 0 0 0 0 0 0 307.91 0.029886 -0.1 -0.08165 0.057735 -0.2553 -0.71155 -0.15064 0.028907 -0.27839 -0.012511 0.065177 0.5063 0.022692 0.00083559 0.077503 0.00015653 0.084194 -1.8866 0.52879 -0.19663 -0.70523 0.13371 0.29921 1.2646 2.8909 0.9095 4.3401 1.0735 0 0 0 0 0 0 0 0 0 0 307.95 0.027543 -0.10233 -0.076362 0.0659 -0.031006 1.7934 -0.35406 -0.11291 -0.037578 -0.051702 0.00096136 3.2162 0.12536 0.012748 0.0014121 0.0026731 0.22429 2.5049 -0.20342 -0.14181 0.24082 -0.039191 2.5118 2.2066 0.28658 0.43654 0.4743 0.21373 0 0 0 0 0 0 0 0 0 0 307.11 0.025189 -0.10448 -0.070772 0.073603 -0.087856 -1.3767 0.11413 0.14945 0.38647 0.053176 0.0077187 1.8954 0.013025 0.022337 0.14936 0.0028277 -0.056851 -3.1701 0.46819 0.26236 0.42404 0.10488 0.24788 3.5622 2.2959 2.2474 1.502 0.61816 0 0 0 0 0 0 0 0 0 0 307.16 0.022824 -0.10645 -0.064904 0.08079 -0.064149 1.0069 -0.27141 -0.098853 0.75627 0.012638 0.0041151 1.0139 0.073666 0.009772 0.57194 0.00015973 0.023707 2.3837 -0.38554 -0.24831 0.3698 -0.040537 0.0097827 1.9977 1.1911 1.5124 1.1377 0.22466 0 0 0 0 0 0 0 0 0 0 306.55 0.020448 -0.10823 -0.058779 0.08741 0.056366 -0.56967 -0.0097419 -0.022867 0.42442 0.098335 0.0031772 0.32453 9.4904e-05 0.00052289 0.18013 0.0096698 0.12052 -1.5766 0.26167 0.075987 -0.33185 0.085697 0.66597 0.88418 0.78267 0.25318 0.97861 0.3844 0 0 0 0 0 0 0 0 0 0 306.54 0.018063 -0.10982 -0.052422 0.093417 0.020435 0.42041 -0.24659 -0.16553 0.36331 0.0977 0.00041759 0.17675 0.060808 0.027399 0.13199 0.0095452 -0.035931 0.99009 -0.23685 -0.14266 -0.061111 -0.00063561 0.11758 0.34241 0.40627 0.44254 0.038404 0.01643 0 0 0 0 0 0 0 0 0 0 306.78 0.015671 -0.11122 -0.045859 0.098769 0.12855 0.1741 0.16699 -0.066866 0.48185 0.24053 0.016525 0.030311 0.027887 0.004471 0.23218 0.057855 0.10811 -0.24631 0.41359 0.09866 0.11854 0.14283 0.52446 0.022402 1.8185 0.38979 0.10919 1.2436 0 0 0 0 0 0 0 0 0 0 307.12 0.013272 -0.11242 -0.039114 0.10343 0.26081 1.859 -0.084941 -0.21123 0.47271 0.18015 0.068021 3.4559 0.007215 0.044619 0.22345 0.032456 0.13226 1.6849 -0.25194 -0.14437 -0.0091483 -0.060377 0.81554 0.99621 0.4671 0.45477 0.0019111 0.41721 0 0 0 0 0 0 0 0 0 0 306.97 0.010867 -0.11342 -0.032215 0.10736 0.13062 -0.50999 0.349 -0.053979 0.17993 0.28831 0.017062 0.26009 0.1218 0.0029138 0.032377 0.083124 -0.13019 -2.369 0.43394 0.15725 -0.29277 0.10816 1.084 1.9916 1.99 0.87881 0.76518 0.66366 0 0 0 0 0 0 0 0 0 0 306.94 0.0084568 -0.11423 -0.025189 0.11054 0.15598 2.0718 -0.065457 -0.18305 0.83806 0.2882 0.02433 4.2925 0.0042846 0.033507 0.70235 0.083061 0.025361 2.5818 -0.41446 -0.12907 0.65813 -0.00010939 0.012357 2.3445 1.3916 0.35119 3.6536 0.015282 0 0 0 0 0 0 0 0 0 0 306.29 0.0060432 -0.11484 -0.018063 0.11295 0.22425 0.0074232 0.3498 -0.02641 0.62779 0.44245 0.050287 5.5104e-05 0.12236 0.00069747 0.39412 0.19577 0.068266 -2.0644 0.41526 0.15664 -0.21027 0.15425 0.18404 1.5135 1.8322 0.87266 0.40072 1.4741 0 0 0 0 0 0 0 0 0 0 306.22 0.003627 -0.11524 -0.010867 0.11456 0.24235 0.80486 -0.14803 -0.13032 0.64749 0.46108 0.058735 0.64779 0.021912 0.016983 0.41924 0.21259 0.018107 0.79743 -0.49783 -0.10391 0.019699 0.018624 0.0032972 0.22152 2.0569 0.20992 0.0016654 0.0014999 0 0 0 0 0 0 0 0 0 0 306.88 0.0012092 -0.11544 -0.003627 0.11537 0.32603 0.028841 0.13657 -0.32187 0.95681 0.49762 0.1063 0.00083178 0.018652 0.1036 0.91549 0.24763 0.083679 -0.77602 0.2846 -0.19155 0.30932 0.036545 0.29505 0.21575 0.91143 0.85841 0.79108 0.03765 0 0 0 0 0 0 0 0 0 0 307.23 -0.0012092 -0.11544 0.003627 0.11537 0.29709 -0.73831 0.10653 -0.13054 0.53424 0.60399 0.088264 0.54511 0.011348 0.017042 0.28541 0.36481 -0.028941 -0.76715 -0.030045 0.19132 -0.42258 0.10637 0.084747 0.21089 3.5732e-05 1.2533 1.5752 0.63866 0 0 0 0 0 0 0 0 0 0 307.04 -0.003627 -0.11524 0.010867 0.11456 0.25735 0.67654 0.25511 -0.23601 0.61811 0.62078 0.066229 0.4577 0.065079 0.055703 0.38206 0.38537 -0.039743 1.4149 0.14858 -0.10547 0.083874 0.016789 0.13774 0.70158 0.29094 0.21764 0.05237 0.00052123 0 0 0 0 0 0 0 0 0 0 306.76 -0.0060432 -0.11484 0.018063 0.11295 0.26608 0.81637 -0.088755 -0.33431 0.62371 0.52145 0.070797 0.66646 0.0078774 0.11176 0.38902 0.27191 0.0087284 0.13983 -0.34386 -0.098295 0.0055996 -0.099335 0.00014538 0.0063719 0.9295 0.18333 2.5404e-07 0.96733 0 0 0 0 0 0 0 0 0 0 306.14 -0.0084568 -0.11423 0.025189 0.11054 0.19609 -0.74657 0.24106 -0.16319 0.56348 0.57628 0.038453 0.55736 0.058109 0.026629 0.31751 0.3321 -0.069983 -1.5629 0.32981 0.17112 -0.060228 0.054834 0.35421 0.86897 1.1941 1.0233 0.037397 0.12428 0 0 0 0 0 0 0 0 0 0 307.17 -0.010867 -0.11342 0.032215 0.10736 0.24954 1.8233 0.025628 -0.46402 0.80267 0.50481 0.062271 3.3244 0.00065679 0.21532 0.64428 0.25483 0.053447 2.5699 -0.21543 -0.30084 0.23919 -0.071476 0.1019 2.3228 0.32717 2.2817 0.46776 0.55071 0 0 0 0 0 0 0 0 0 0 306.65 -0.013272 -0.11242 0.039114 0.10343 0.274 -0.44729 0.025243 -0.096508 0.67556 0.55809 0.075076 0.20007 0.0006372 0.0093139 0.45638 0.31146 0.024458 -2.2706 -0.00038511 0.36751 -0.12712 0.053284 0.010913 1.83 0.0071537 4.2479 0.15161 0.11499 0 0 0 0 0 0 0 0 0 0 306.68 -0.015671 -0.11122 0.045859 0.098769 0.33441 1.2379 -0.066206 -0.31616 0.82511 0.56197 0.11183 1.5324 0.0043832 0.099957 0.6808 0.31581 0.060414 1.6852 -0.091449 -0.21965 0.14955 0.0038846 0.13752 0.99653 0.037424 1.1592 0.17747 0.007922 0 0 0 0 0 0 0 0 0 0 306.26 -0.018063 -0.10982 0.052422 0.093417 0.36072 -0.074802 -0.0047737 -0.095154 0.26704 0.66114 0.13012 0.0055953 2.2789e-05 0.0090544 0.071311 0.4371 0.026311 -1.3127 0.061432 0.221 -0.55806 0.099163 0.013971 0.6138 0.074703 1.6336 2.7293 0.54273 0 0 0 0 0 0 0 0 0 0 307.44 -0.020448 -0.10823 0.058779 0.08741 0.30794 0.0068624 0.10114 -0.23402 0.53998 0.70924 0.094825 4.7092e-05 0.01023 0.054767 0.29158 0.50303 -0.052788 0.081664 0.10592 -0.13887 0.27294 0.048106 0.21881 0.0020478 0.16739 0.41601 0.6128 0.086573 0 0 0 0 0 0 0 0 0 0 307.49 -0.022824 -0.10645 0.064904 0.08079 0.30768 0.46156 -0.60505 -0.30072 0.59907 0.53558 0.094669 0.21304 0.36609 0.090431 0.35888 0.28685 -0.00025291 0.4547 -0.70619 -0.066694 0.059084 -0.17366 0.0061767 0.071267 4.2864 0.067234 0.024401 2.6493 0 0 0 0 0 0 0 0 0 0 307.61 -0.025189 -0.10448 0.070772 0.073603 0.34467 -0.56589 -0.25812 -0.20292 0.82855 0.66517 0.1188 0.32023 0.066627 0.041176 0.68649 0.44246 0.036983 -1.0275 0.34693 0.0978 0.22948 0.12959 0.038911 0.37691 1.311 0.38408 0.42967 1.0008 0 0 0 0 0 0 0 0 0 0 307.42 -0.027543 -0.10233 0.076362 0.0659 0.53363 1.3698 -0.63329 -0.17453 0.92306 0.61591 0.28476 1.8763 0.40105 0.030461 0.85205 0.37934 0.18896 1.9357 -0.37516 0.028387 0.094514 -0.049266 1.7506 1.3159 1.1229 0.061905 0.067611 0.30209 0 0 0 0 0 0 0 0 0 0 307.32 -0.029886 -0.1 0.08165 0.057735 0.38802 -1.0879 -0.0074791 -0.33933 0.62117 0.69396 0.15056 1.1836 5.5937e-05 0.11515 0.38586 0.48158 -0.14561 -2.4577 0.62581 -0.1648 -0.30189 0.078051 1.3349 2.1432 3.9858 0.61399 0.81265 0.30663 0 0 0 0 0 0 0 0 0 0 307.39 -0.032215 -0.097495 0.086615 0.049165 0.4513 1.1389 -0.51289 -0.4478 0.81962 0.61478 0.20367 1.2972 0.26305 0.20053 0.67178 0.37796 0.06328 2.2269 -0.50541 -0.10847 0.19845 -0.079174 0.15372 1.743 2.1239 0.23283 0.31872 0.65418 0 0 0 0 0 0 0 0 0 0 306.96 -0.03453 -0.094818 0.091239 0.04025 0.58298 -0.4225 -0.087831 -0.13553 0.56668 0.75324 0.33986 0.17851 0.0077142 0.018367 0.32113 0.56738 0.13168 -1.5614 0.42506 0.31227 -0.25294 0.13846 0.80777 0.86731 1.9142 3.1183 0.57463 1.1605 0 0 0 0 0 0 0 0 0 0 306.67 -0.03683 -0.091975 0.095503 0.031052 0.64976 2.0793 -0.32186 -0.58463 0.72908 0.61827 0.42219 4.3234 0.10359 0.34179 0.53156 0.38226 0.066781 2.5018 -0.23403 -0.4491 0.1624 -0.13497 0.17472 2.2011 0.39536 5.3029 0.21063 1.6702 0 0 0 0 0 0 0 0 0 0 306.11 -0.039114 -0.088971 0.09939 0.021637 0.62916 -1.0838 -0.1902 -0.39154 0.59346 0.72518 0.39585 1.1747 0.036177 0.1533 0.3522 0.52589 -0.020595 -3.1631 0.13166 0.19309 -0.13562 0.10691 0.052575 3.5465 0.23788 1.2745 0.17164 0.64616 0 0 0 0 0 0 0 0 0 0 307.17 -0.041381 -0.085811 0.10288 0.01207 0.63383 1.76 -0.66692 -0.72706 0.38527 0.62868 0.40174 3.0976 0.44478 0.52862 0.14843 0.39523 0.0046647 2.8438 -0.47672 -0.33552 -0.20819 -0.096506 0.0017776 2.8456 1.8762 2.876 0.39303 0.91972 0 0 0 0 0 0 0 0 0 0 307 -0.043629 -0.0825 0.10597 0.0024182 0.69052 -0.61539 -0.36291 -0.42252 0.25423 0.76164 0.47682 0.37871 0.1317 0.17853 0.064632 0.5801 0.056697 -2.3754 0.30401 0.30454 -0.13104 0.13297 0.11785 2.0024 1.0281 2.974 0.1607 1.0602 0 0 0 0 0 0 0 0 0 0 308.04 -0.045859 -0.079045 0.10864 -0.0072504 0.71466 0.15432 -0.26335 -0.58981 0.37796 0.83654 0.51074 0.023814 0.069355 0.34788 0.14285 0.69979 0.024139 0.76971 0.099553 -0.16729 0.12373 0.074893 0.010426 0.20628 0.15187 0.635 0.11946 0.27706 0 0 0 0 0 0 0 0 0 0 307.7 -0.048068 -0.075451 0.11089 -0.016868 0.58864 1.112 -0.21217 -0.77886 0.61283 0.74828 0.3465 1.2366 0.045014 0.60662 0.37556 0.55992 -0.12602 0.95769 0.051189 -0.18904 0.23487 -0.08826 1.0207 0.32024 0.058586 0.83375 0.45061 0.78776 0 0 0 0 0 0 0 0 0 0 307.62 -0.050256 -0.071724 0.11269 -0.026368 0.61218 -1.2711 -0.14961 -0.60994 0.11272 0.84456 0.37477 1.6158 0.022382 0.37203 0.012706 0.71328 0.02354 -2.3831 0.062558 0.16892 -0.50011 0.096284 0.0095388 2.0154 0.076594 0.99954 2.1971 0.50659 0 0 0 0 0 0 0 0 0 0 307.4 -0.052422 -0.067872 0.11405 -0.035682 0.58485 1.3089 -0.17225 -0.72587 0.61546 0.73665 0.34205 1.7133 0.02967 0.52689 0.37879 0.54266 -0.027336 2.5801 -0.022643 -0.11593 0.50274 -0.10791 0.077967 2.3413 0.00027627 0.2729 2.1204 1.119 0 0 0 0 0 0 0 0 0 0 306.77 -0.054565 -0.0639 0.11496 -0.044746 0.70149 -0.30594 -0.34613 -0.62622 0.13763 0.70896 0.49208 0.093597 0.11981 0.39215 0.018941 0.50263 0.11664 -1.6149 -0.17388 0.099652 -0.47784 -0.027687 0.61992 0.92746 0.19815 0.39644 2.0079 0.13149 0 0 0 0 0 0 0 0 0 0 307.52 -0.056685 -0.059817 0.11541 -0.053497 0.70089 0.95568 -0.2661 -0.77007 0.43857 0.67277 0.49124 0.91331 0.070808 0.593 0.19234 0.45262 -0.00059874 1.2616 0.080037 -0.14385 0.30094 -0.036191 0.006586 0.55731 0.10898 0.45103 0.74799 0.19037 0 0 0 0 0 0 0 0 0 0 307.3 -0.058779 -0.055628 0.11541 -0.061872 0.74664 -0.5417 -0.60205 -0.68566 0.4047 0.66999 0.55747 0.29344 0.36246 0.47013 0.16378 0.44889 0.045752 -1.4974 -0.33595 0.084402 -0.03387 -0.002782 0.068757 0.79784 0.88352 0.30046 0.013491 0.021544 0 0 0 0 0 0 0 0 0 0 307.6 -0.060848 -0.051342 0.11496 -0.069813 0.78493 0.34048 -0.41604 -0.74681 0.44101 0.70683 0.61611 0.11592 0.17309 0.55773 0.19449 0.49961 0.03829 0.88217 0.18601 -0.06115 0.036307 0.036837 0.042825 0.27146 0.42727 0.052747 0.0080052 0.038641 0 0 0 0 0 0 0 0 0 0 307.44 -0.062889 -0.046966 0.11405 -0.077265 0.77582 0.20229 -0.88254 -0.55386 0.36748 0.73023 0.60189 0.04092 0.77888 0.30676 0.13504 0.53324 -0.0091109 -0.13819 -0.4665 0.19295 -0.073524 0.023402 0.020797 0.0072953 1.7917 1.2729 0.053982 0.0064227 0 0 0 0 0 0 0 0 0 0 307.19 -0.064904 -0.042507 0.11269 -0.084174 0.72271 -0.48828 -0.56724 -0.55151 0.026428 0.78943 0.5223 0.23841 0.32176 0.30416 0.00069841 0.6232 -0.053113 -0.69056 0.3153 0.0023558 -0.34105 0.059196 0.22107 0.17115 1.0992 0.012034 1.0327 0.15236 0 0 0 0 0 0 0 0 0 0 307.82 -0.06689 -0.037974 0.11089 -0.090493 0.68862 1.7289 -0.75262 -0.90837 0.20233 0.64099 0.4742 2.9893 0.56644 0.82513 0.040938 0.41086 -0.034087 2.2172 -0.18539 -0.35686 0.1759 -0.14844 0.1084 1.7279 0.23065 3.2758 0.2485 1.9856 0 0 0 0 0 0 0 0 0 0 306.95 -0.068846 -0.033375 0.10864 -0.096177 0.74513 -1.1191 -0.51145 -0.63509 -0.17359 0.82654 0.55522 1.2525 0.26158 0.40334 0.030133 0.68317 0.056515 -2.8481 0.24118 0.27328 -0.37592 0.18555 0.11693 2.8764 0.67587 2.4257 1.2508 2.2064 0 0 0 0 0 0 0 0 0 0 307.24 -0.070772 -0.028716 0.10597 -0.10119 0.77544 0.58329 -0.57195 -0.74141 0.12347 0.89216 0.6013 0.34023 0.32713 0.54968 0.015245 0.79596 0.030302 1.7024 -0.060505 -0.10632 0.29706 0.065623 0.021833 1.0171 0.0097965 0.22188 0.72844 0.19895 0 0 0 0 0 0 0 0 0 0 306.85 -0.072668 -0.024008 0.10288 -0.10549 0.90709 1.6819 -0.88189 -0.8845 0.35694 0.85351 0.82281 2.8287 0.77772 0.78234 0.12741 0.72847 0.13165 1.0986 -0.30993 -0.14309 0.23347 -0.038659 0.80742 0.42202 0.7405 0.44564 0.44512 0.20949 0 0 0 0 0 0 0 0 0 0 307.72 -0.074531 -0.019257 0.09939 -0.10905 1.0635 -0.44038 -0.65 -0.8889 0.014957 0.95774 1.131 0.19394 0.42249 0.79014 0.00022372 0.91726 0.15638 -2.1222 0.23189 -0.0043989 -0.34198 0.10423 1.1702 1.5992 0.63005 0.0054172 1.0383 0.60941 0 0 0 0 0 0 0 0 0 0 307.55 -0.076362 -0.014472 0.095503 -0.11184 0.95703 -0.30329 -1.238 -0.8345 -4.8746e-05 0.87442 0.91591 0.091983 1.5326 0.69639 2.3762e-09 0.76461 -0.10643 0.13709 -0.58798 0.054397 -0.015006 -0.083317 0.74853 0.0061146 2.9222 0.15039 0.0037064 0.71355 0 0 0 0 0 0 0 0 0 1 308.86 -0.078159 -0.0096623 0.091239 -0.11385 0.88239 -0.38169 -0.86428 -0.97796 -0.43631 0.9096 0.77861 0.14569 0.74697 0.95641 0.19036 0.82738 -0.074647 -0.078401 0.3737 -0.14346 -0.43626 0.035182 0.39654 0.0024879 1.5048 0.44827 1.6775 0.033206 0 0 0 0 0 0 0 0 0 0 308.24 -0.079922 -0.0048354 0.086615 -0.11507 0.94648 1.056 -1.1983 -1.0479 -0.51291 0.76094 0.89582 1.1151 1.4359 1.0981 0.26308 0.57904 0.064089 1.4377 -0.33401 -0.069961 -0.076605 -0.14866 0.15845 0.72447 0.87243 0.076593 0.058258 1.9909 0 0 0 0 0 0 0 0 0 0 308.14 -0.08165 -2.1212e-17 0.08165 -0.11547 0.94148 -1.0652 -0.60122 -1.0098 -0.59053 0.85731 0.88639 1.1347 0.36147 1.0197 0.34873 0.73498 -0.004996 -2.1212 0.59707 0.038136 -0.077621 0.096364 0.012934 1.5976 3.6431 0.090541 0.059705 0.50758 0 0 0 0 0 0 0 0 0 0 307.12 -0.083342 0.0048354 0.076362 -0.11507 1.0651 1.0564 -1.0552 -1.0113 -0.33493 0.76898 1.1345 1.1161 1.1133 1.0227 0.11218 0.59133 0.12363 2.1217 -0.45393 -0.0015095 0.25561 -0.088329 0.70422 1.5818 1.6904 0.0079285 0.53587 0.78881 0 0 0 0 0 0 0 0 0 0 307.24 -0.084997 0.0096623 0.070772 -0.11385 1.1859 0.06822 -0.48416 -0.92888 -0.75434 0.99531 1.4063 0.0046539 0.23441 0.86281 0.56902 0.99065 0.12074 -0.98822 0.57099 0.082421 -0.41941 0.22633 0.66873 0.34882 3.3455 0.28897 1.552 3.3811 0 0 0 0 0 0 0 0 0 0 306.98 -0.086615 0.014472 0.064904 -0.11184 1.1514 -0.08733 -1.0069 -0.84012 -0.66505 0.95899 1.3258 0.0076266 1.0139 0.70579 0.44229 0.91967 -0.03444 -0.15555 -0.52274 0.08876 0.089289 -0.03632 0.11013 0.0091644 2.2809 0.32653 0.059883 0.19135 0 0 0 0 0 0 0 0 0 0 307.59 -0.088196 0.019257 0.058779 -0.10905 1.2608 1.1569 -0.47196 -1.1295 -0.8448 1.0252 1.5896 1.3385 0.22274 1.2757 0.71369 1.051 0.10939 1.2443 0.53495 -0.28935 -0.17976 0.066179 0.5382 0.54202 2.9551 2.1 0.29551 0.20327 0 0 0 0 0 0 0 0 0 0 307.94 -0.089737 0.024008 0.052422 -0.10549 1.1918 -0.61434 -0.5311 -1.0715 -1.0799 1.1024 1.4204 0.37742 0.28207 1.1482 1.1662 1.2152 -0.068998 -1.7713 -0.059142 0.057928 -0.23511 0.077211 0.34558 1.1151 0.0089898 0.16538 0.49813 0.29862 0 0 0 0 0 0 0 0 0 0 307.88 -0.091239 0.028716 0.045859 -0.10119 1.202 1.2411 -0.49475 -1.2948 -0.82987 1.1165 1.4448 1.5404 0.24478 1.6766 0.68868 1.2467 0.010202 1.8555 0.036349 -0.22331 0.25004 0.014158 1.2953e-06 1.2089 0.038705 1.2017 0.51227 6.8632e-10 0 0 0 0 0 0 0 0 0 0 307.31 -0.092701 0.033375 0.039114 -0.096177 1.2152 -0.091237 -0.66711 -1.1706 -1.0697 1.1129 1.4767 0.0083241 0.44504 1.3703 1.1442 1.2386 0.013176 -1.3324 -0.17236 0.12425 -0.23982 -0.0036361 0.00043628 0.63227 0.19403 0.57926 0.51783 0.023772 0 0 0 0 0 0 0 0 0 0 307.11 -0.094123 0.037974 0.032215 -0.090493 1.1754 0.49677 -0.37239 -1.1954 -0.86082 1.1586 1.3816 0.24678 0.13867 1.4289 0.741 1.3422 -0.039784 0.58801 0.29472 -0.024755 0.20887 0.04565 0.13797 0.11985 0.97139 0.0012375 0.35414 0.074498 0 0 0 0 0 0 0 0 0 0 307.78 -0.095503 0.042507 0.025189 -0.084174 1.1223 1.2403 -0.54516 -1.4008 -0.87225 1.0439 1.2596 1.5383 0.2972 1.9623 0.76083 1.0896 -0.053085 0.74352 -0.17277 -0.20548 -0.011439 -0.1147 0.22088 0.19238 0.19515 1.0019 0.002543 1.2469 0 0 0 0 0 0 0 0 0 0 307.8 -0.096841 0.046966 0.018063 -0.077265 1.1071 -1.1092 -0.43488 -1.0382 -1.0304 1.1057 1.2256 1.2303 0.18912 1.078 1.0617 1.2227 -0.015258 -2.3495 0.11028 0.36259 -0.15813 0.06188 0.036006 1.959 0.17847 4.1401 0.23064 0.17106 0 0 0 0 0 0 0 0 0 0 307.24 -0.098137 0.051342 0.010867 -0.069813 1.1735 1.276 -0.53433 -1.3538 -0.61485 0.98794 1.3771 1.6281 0.28551 1.8328 0.37804 0.97603 0.066433 2.3851 -0.099446 -0.31555 0.41554 -0.11779 0.17258 2.0002 0.047468 2.5254 1.4416 1.3076 0 0 0 0 0 0 0 0 0 0 307.19 -0.09939 0.055628 0.003627 -0.061872 1.2647 -0.74841 -0.66609 -1.1632 -1.0293 1.0555 1.5996 0.56011 0.44368 1.353 1.0595 1.1141 0.091248 -2.0244 -0.13176 0.1906 -0.41448 0.06755 0.3591 1.4555 0.1002 1.2447 1.5163 0.21412 0 0 0 0 0 0 0 0 0 0 307.34 -0.1006 0.059817 -0.003627 -0.053497 1.1757 0.91547 -0.55645 -1.3026 -0.65808 1.0141 1.3824 0.83808 0.30964 1.6967 0.43306 1.0284 -0.088999 1.6639 0.10964 -0.13938 0.37125 -0.041397 0.54174 0.97142 0.17683 0.41952 1.1468 0.23177 0 0 0 0 0 0 0 0 0 0 307.31 -0.10176 0.0639 -0.010867 -0.044746 1.1637 0.46675 -0.92528 -1.2479 -0.77009 0.86949 1.3541 0.21786 0.85615 1.5573 0.59303 0.75601 -0.012077 -0.44871 -0.36883 0.054659 -0.11201 -0.14461 0.027617 0.072882 1.0823 0.15147 0.1191 1.8931 0 0 0 0 0 0 0 0 0 0 306.85 -0.10288 0.067872 -0.018063 -0.035682 1.1991 -0.62065 -0.74142 -1.1619 -0.54547 1.0466 1.4378 0.38521 0.54971 1.3499 0.29754 1.0955 0.035422 -1.0874 0.18386 0.086045 0.22462 0.17715 0.03448 0.42193 0.41874 0.31016 0.41118 1.9954 0 0 0 0 0 0 0 0 0 0 308.09 -0.10396 0.071724 -0.025189 -0.026368 1.2545 1.7329 -1.1295 -1.127 -0.77637 1.0065 1.5738 3.003 1.2757 1.2702 0.60275 1.0129 0.055415 2.3536 -0.38803 0.034832 -0.2309 -0.040189 0.11142 1.9474 1.2077 0.080228 0.48089 0.2218 0 0 0 0 0 0 0 0 0 0 307.62 -0.10499 0.075451 -0.032215 -0.016868 1.2643 -0.70513 -0.80552 -0.97628 -0.82136 1.1697 1.5986 0.49721 0.64886 0.95312 0.67463 1.3681 0.0098423 -2.438 0.32394 0.15076 -0.044989 0.16321 1.4484e-05 2.1091 1.1552 0.81495 0.022121 1.6686 0 0 0 0 0 0 0 0 0 0 308.53 -0.10597 0.079045 -0.039114 -0.0072504 1.1092 0.91563 -1.2254 -1.1715 -1.071 1.0308 1.2303 0.83838 1.5016 1.3725 1.1469 1.0625 -0.15517 1.6208 -0.41989 -0.19526 -0.2496 -0.13887 1.5037 0.92157 1.431 0.89551 0.55987 1.7587 0 0 0 0 0 0 0 0 0 0 308.06 -0.10691 0.0825 -0.045859 0.0024182 1.0447 -0.45277 -0.81038 -1.1212 -0.78821 1.0781 1.0914 0.205 0.65671 1.257 0.62128 1.1622 -0.064454 -1.3684 0.41503 0.050379 0.28274 0.047266 0.30713 0.66677 1.8304 0.1342 0.65861 0.082342 0 0 0 0 0 0 0 0 0 0 308.07 -0.1078 0.085811 -0.052422 0.01207 1.0157 0.48483 -1.0849 -1.1954 -0.51378 0.93758 1.0317 0.23506 1.1771 1.4289 0.26397 0.87906 -0.028993 0.93759 -0.27457 -0.074225 0.27444 -0.14048 0.084974 0.30687 0.56635 0.089724 0.61969 1.7958 0 0 0 0 0 0 0 0 0 0 308.33 -0.10864 0.088971 -0.058779 0.021637 0.9683 -1.1171 -0.74931 -1.037 -1.1022 1.0348 0.93761 1.2479 0.56147 1.0753 1.2148 1.0708 -0.047419 -1.6019 0.33564 0.15843 -0.58839 0.097228 0.18318 0.91272 1.2332 0.8906 3.0309 0.5183 0 0 0 0 0 0 0 0 0 0 307.85 -0.10944 0.091975 -0.064904 0.031052 1.0257 1.3037 -1.1199 -1.3512 -0.54829 0.89379 1.052 1.6995 1.2543 1.8257 0.30062 0.79886 0.057387 2.4208 -0.37063 -0.31423 0.55388 -0.14102 0.12139 2.0605 1.0938 2.5031 2.5792 1.8084 0 0 0 0 0 0 0 0 0 0 307.54 -0.11019 0.094818 -0.070772 0.04025 1.0746 -0.52169 -0.76081 -1.0808 -0.94775 1.0274 1.1549 0.27216 0.57883 1.1681 0.89824 1.0555 0.048953 -1.8253 0.35914 0.27042 -0.39946 0.13357 0.081758 1.1841 1.3978 2.3784 1.4098 1.0709 0 0 0 0 0 0 0 0 0 0 306.97 -0.11089 0.097495 -0.076362 0.049165 1.3508 2.0389 -0.49923 -1.2401 -0.94347 0.9416 1.8247 4.1572 0.24923 1.5378 0.89013 0.88661 0.27617 2.5606 0.26158 -0.1593 0.0042865 -0.085759 3.8775 2.306 0.78219 0.56878 1.8934e-05 0.74975 0 0 0 0 0 0 0 0 0 0 306.89 -0.11154 0.1 -0.08165 0.057735 1.253 0.033519 -0.91362 -1.2653 -0.81714 0.97409 1.5701 0.0011236 0.83471 1.601 0.66772 0.94884 -0.09779 -2.0054 -0.4144 -0.025217 0.12633 0.032488 0.64186 1.4284 1.3912 0.0014171 0.12478 0.025243 0 0 0 0 0 0 0 0 0 0 306.54 -0.11214 0.10233 -0.086615 0.0659 1.1781 0.95734 -0.43246 -1.4601 -0.66632 0.93455 1.388 0.9165 0.18702 2.132 0.44398 0.87339 -0.074879 0.92382 0.48117 -0.19484 0.15082 -0.039532 0.39871 0.29787 2.4175 0.89132 0.18063 0.21647 0 0 0 0 0 0 0 0 0 0 307.95 -0.11269 0.10448 -0.091239 0.073603 1.1331 -0.55594 -0.93668 -1.2231 -0.67435 0.95728 1.284 0.30907 0.87736 1.496 0.45474 0.91639 -0.045007 -1.5133 -0.50422 0.237 -0.0080321 0.022727 0.16821 0.81481 2.1133 1.8594 0.0016358 0.0055193 0 0 0 0 0 0 0 0 0 0 307.75 -0.11319 0.10645 -0.095503 0.08079 1.0794 0.012593 -0.75276 -1.335 -0.61364 0.97318 1.1651 0.00015858 0.56665 1.7822 0.37655 0.94708 -0.053735 0.56853 0.18391 -0.11185 0.06071 0.015901 0.22543 0.11196 0.41896 0.25058 0.025912 0.0002289 0 0 0 0 0 0 0 0 0 0 308.52 -0.11365 0.10823 -0.09939 0.08741 1.1332 0.48589 -0.99342 -1.3215 -0.44246 0.94369 1.2841 0.23609 0.98689 1.7464 0.19577 0.89055 0.053787 0.4733 -0.24066 0.013469 0.17117 -0.029495 0.10352 0.07729 0.42122 0.028589 0.23487 0.1431 0 0 0 0 0 0 0 0 0 0 308.46 -0.11405 0.10982 -0.10288 0.093417 1.2264 -0.020975 -0.71618 -1.186 -0.60032 1.0067 1.504 0.00043997 0.51292 1.4067 0.36039 1.0134 0.093178 -0.50686 0.27724 0.13546 -0.15786 0.063 0.37644 0.092737 0.86903 0.67405 0.22987 0.17919 0 0 0 0 0 0 0 0 0 0 307.37 -0.1144 0.11122 -0.10597 0.098769 1.3325 0.8662 -1.0612 -1.1972 -0.57585 0.94382 1.7755 0.7503 1.1262 1.4332 0.33161 0.89079 0.10611 0.88718 -0.34503 -0.011125 0.02447 -0.062872 0.50314 0.27457 0.93641 0.001418 0.0030017 0.4456 0 0 0 0 0 0 0 0 0 0 308 -0.1147 0.11242 -0.10864 0.10343 1.4222 -0.57025 -0.78384 -1.2023 -1.0057 1.0845 2.0226 0.32518 0.6144 1.4454 1.0115 1.1761 0.0897 -1.4364 0.27738 -0.0050955 -0.42987 0.14065 0.3455 0.73446 0.86981 0.0048831 1.6293 1.2018 0 0 0 0 0 0 0 0 0 0 307.16 -0.11496 0.11342 -0.11089 0.10736 1.4478 1.6858 -1.1967 -1.2118 -0.68771 1.0644 2.0962 2.8421 1.432 1.4685 0.47294 1.133 0.025666 2.2561 -0.41284 -0.0095618 0.31802 -0.020064 0.012863 1.7891 1.38 0.0021171 0.83704 0.087943 0 0 0 0 0 0 0 0 0 0 307.42 -0.11516 0.11423 -0.11269 0.11054 1.4427 0.68909 -0.85908 -1.1878 -1.1139 1.1314 2.0814 0.47485 0.73802 1.4108 1.2408 1.28 -0.0051363 -0.99675 0.33759 0.024068 -0.42619 0.066959 0.013172 0.35484 1.2465 0.050952 1.6019 0.20941 0 0 0 0 0 0 0 0 0 0 306.98 -0.11531 0.11484 -0.11405 0.11295 1.3456 1.4611 -1.3238 -1.352 -0.92388 0.96464 1.8106 2.1348 1.7525 1.8279 0.85356 0.93053 -0.097123 0.77201 -0.46473 -0.16425 0.19001 -0.16672 0.63395 0.20752 1.7773 0.60934 0.29143 2.4571 0 0 0 0 0 0 0 0 0 0 307.57 -0.11541 0.11524 -0.11496 0.11456 1.3961 -0.37065 -0.91385 -1.4284 -0.95558 1.0758 1.949 0.13739 0.83512 2.0403 0.91314 1.1574 0.050491 -1.8318 0.40996 -0.076399 -0.031701 0.11119 0.088401 1.1924 1.7887 0.096817 0.012056 0.70716 0 0 0 0 0 0 0 0 0 0 308.03 -0.11546 0.11544 -0.11541 0.11537 ______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values |
Warning: Converting dat field from double to single format
0 images
Warning: Columns of X are linearly dependent to within machine precision.
Using only the first 110 components to compute TSQUARED.
Retained 9 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 52.00% Expected 7.50 outside 95% ellipsoid, found 14 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 14 images Cases 10 19 57 61 87 95 96 97 102 103 128 129 138 140
Warning: Columns of X are linearly dependent to within machine precision.
Using only the first 111 components to compute TSQUARED.
Retained 9 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 50.00% Expected 7.50 outside 95% ellipsoid, found 11 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 11 images Cases 19 51 61 87 96 97 102 103 128 129 144 Mahalanobis (cov and corr, q<0.05 corrected): 0 images Outlier_count Percentage _____________ __________ global_mean 5 3.3333 global_mean_to_variance 5 3.3333 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 3 2 mahal_cov_uncor 14 9.3333 mahal_cov_corrected 0 0 mahal_corr_uncor 11 7.3333 mahal_corr_corrected 0 0 Overall_uncorrected 23 15.333 Overall_corrected 9 6 Compressed NIfTI files are not supported. Compressed NIfTI files are not supported. Compressed NIfTI files are not supported. SPM12: spm_check_registration (v7759) 01:04:50 - 27/03/2025 ======================================================================== Display /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/fmriprep20_template.nii.gz,1 (all) /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/fmriprep20_template.nii.gz,1 /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/fmriprep20_template.nii.gz,1 Grouping contiguous voxels: 1 regions Grouping contiguous voxels: 1 regions Grouping contiguous voxels: 1 regions
ans = 150×1 logical array
0 0 0 0 0 0 0 0 0 1
denoise_timeseries_pipeline finished.
 
Steps taken by denoise_timeseries_pipeline
1. Load the movement parameters file (mvmtfname) and compute 24 movement-related regressors.
2. If 'images_per_run' is provided, create run-specific intercept regressors and add these to the covariate matrix.
3. Identify spike and high framewise-displacement outlier images using outliers(), and append the resulting regressors.
4. Extract the mean CSF signal using extract_gray_white_csf() and add it as a regressor.
5. (Optional) Perform PCA-based denoising if 'pca_denoise' is true.
6. Apply a high-pass filter to the time series using use_spm_filter with TR and HP_cutoff_sec.
7. Rescale the combined nuisance covariates for visualization.
8. Visualize the final covariate matrix if requested
9. Regress out the nuisance covariates from the 4-D time series (using regress with residual and grand mean scaling).
10. Attach the covariates and metadata table to the denoised object.
11. Plot the denoised object data (if requested)
12. Save the denoised object to disk if requested.

A brief overview of steps

The code below loads some sample data and does the complete filtering and nuisance regression
% Load the key 4-D image file into an object
 
fname = which('swrsub-sid001567_task-pinel_acq-s1p2_run-03_bold.nii.gz');
obj = fmri_data(fname);
Using default mask: /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 145720800 bytes Loading image number: 150 Elapsed time is 0.499009 seconds. Image names entered, but fullpath attribute is empty. Getting path info. .fullpath should have image name for each image column in .dat Attempting to expand image filenames in case image list is unexpanded 4-D images Number of unique values in dataset: 493 Bit rate: 8.95 bits Warning: Number of unique values in dataset is low, indicating possible restriction of bit rate. For comparison, Int16 has 65,536 unique values
 
% Get the TR
 
json_struct = jsondecode(fileread(which('sub-sid001567_task-pinel_acq-s1p2_run-03_bold.json')));
TR = json_struct.RepetitionTime;
 
% Obtain a matrix of 'spike' indicators and movement-related regressors
% based on multiple criteria to use as covariates
 
% 24 movement-related covariates per run
mvmtfname = which('rp_sub-sid001567_task-pinel_acq-s1p2_run-03_bold.txt');
[mvmt_matrix, mvmt_regs_24, mvmt_table] = movement_regressors(mvmtfname);
 
covs = mvmt_regs_24;
 
% 'spike' outliers and high framewise-displacement (fd) images
[est_outliers_uncorr, est_outliers_corr, outlier_tables] = outliers(obj, 'fd', mvmt_matrix);
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | rmssd | Missing values | 0 images Retained 2 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 18.67% Expected 7.50 outside 95% ellipsoid, found 6 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 1 Uncorrected: 6 images Cases 1 2 3 4 5 6 Retained 2 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 22.67% Expected 7.50 outside 95% ellipsoid, found 6 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 1 Uncorrected: 6 images Cases 1 2 3 4 5 6 Mahalanobis (cov and corr, q<0.05 corrected): 1 images Framewise Displacement (before and after >0.50 mm correction): 0 images Outlier_count Percentage _____________ __________ global_mean 6 4 global_mean_to_variance 4 2.6667 missing_values 0 0 rmssd_dvars 1 0.66667 spatial_variability 4 2.6667 mahal_cov_uncor 6 4 mahal_cov_corrected 1 0.66667 mahal_corr_uncor 6 4 mahal_corr_corrected 1 0.66667 fd 0 0 Overall_uncorrected 10 6.6667 Overall_corrected 8 5.3333
sum(est_outliers_uncorr) % this shows how many outliers
ans = 10
 
covs = [covs outlier_tables.outlier_regressor_matrix_uncorr];
 
% build a table as well to save for later, with names
out_table = array2table(outlier_tables.outlier_regressor_matrix_uncorr);
out_table.Properties.VariableNames = strrep(out_table.Properties.VariableNames, 'Var', 'Out');
cov_table = [mvmt_table out_table];
 
% Mean CSF
[gwcsfvalues, gwcsfcomponents] = extract_gray_white_csf(obj);
Extracting from gray_matter_mask_sparse.img. Removing 2565 voxels with one or more NaNs Extracting from canonical_white_matter.img. Removing 106 voxels with one or more NaNs Extracting from canonical_ventricles.img. Removing 158 voxels with one or more NaNs
meancsf = gwcsfvalues(:, 3);
covs = [covs meancsf];
 
cov_table = addvars(cov_table, meancsf, 'NewVariableNames','MeanCSF');
 
% Here the first component is a head-shift artifact; this will not always
% be the case. The second is highly related to head movement.
% You could use PCA or ICA denoising strategies but be
% careful. The 'pca_denoise' option in the pipeline will attempt to
% identify components strongly related to motion and reconstruct the data
% without them. But you could remove task-related variance too.
[component_scores, eigenmap_obj, explained] = pca(obj, 'k', 3);
Warning: Columns of X are linearly dependent to within machine precision.
Using only the first 2 components to compute TSQUARED.
 
% High-pass filter - Use TR read in earlier
HP_cutoff_sec = 128;
[S,KL,KH] = use_spm_filter(TR, size(obj.dat, 2),'none', 'specify', HP_cutoff_sec);
 
covs = [covs KH];
 
% create high-pass filter table with names and add it
KH_table = array2table(KH);
KH_table.Properties.VariableNames = strrep(KH_table.Properties.VariableNames, 'Var', 'HPfilt');
cov_table = [cov_table KH_table];
 
% Rescale for convenience and visualization
covs = covs ./ max(abs(covs), [], 1);
 
% visualize the final cov matrix
 
create_figure('all covs');
imagesc(covs);
set(gca, 'YDir', 'Reverse'); axis tight
colormap(colormap_tor([0 0 1], [1 1 0], [.2 .5 1], [.5 .5 .5], [1 .5 .2]))
 
% Regress all covs out from each voxel and return residuals
% We can ignore colinearity/leverage warnings
% - use the 'residual' option to return residuals after removing covariates
% - use the 'add_voxelwise_intercept' option to preserve the mean signal in
% each voxel. This doesn't matter if we are only calculating correlations,
% but can matter if we are doing anything that requires or interacts with
% maps of the overall level of signal in each voxel, like spatial
% correlations or SPM analyses with implicit masking.
% - use the 'grandmeanscale' option to rescale the entire 4-D dataset
% (usually run) to a grand mean of 100. This doesn't matter if we're only
% calculating within-run correlations, but matters if we are going to stack
% data across runs that may be on a different scale.
 
obj.X = covs;
regress_output = regress(obj, 'residual', 'grandmeanscale', 'add_voxelwise_intercept', 'noverbose');
obj_denoised = regress_output.resid;
 
% Attach covs for later reference
obj_denoised.covariates = covs;
obj_denoised.metadata_table = cov_table;
 
disp('obj_denoised.metadata_table')
obj_denoised.metadata_table
obj_denoised.metadata_table
ans = 150×39 table
 mvmt_xmvmt_ymvmt_zmvmt_rollmvmt_pitchmvmt_yawmvmt_x^2mvmt_y^2mvmt_z^2mvmt_roll^2mvmt_pitch^2mvmt_yaw^2mvmt_xdiffmvmt_ydiffmvmt_zdiffmvmt_rolldiffmvmt_pitchdiffmvmt_yawdiffmvmt_xdiff^2mvmt_ydiff^2mvmt_zdiff^2mvmt_rolldiff^2mvmt_pitchdiff^2mvmt_yawdiff^2Out1Out2Out3Out4Out5Out6Out7Out8Out9Out10MeanCSFKH1KH2KH3KH4
1-0.1573-1.19913.29931.2974-1.8213-1.04740.02481.437910.88511.68333.31721.09710000000.00591.0776e-050.00740.00942.8598e-040.01501000000000303.40020.11550.11540.11540.1154
2-0.4925-1.35823.85131.2745-2.8581-1.27340.24261.844814.83271.62428.16851.6215-0.3352-0.15910.5521-0.0229-1.0367-0.22606.55240.00963.13756.5022e-049.33084.33040100000000305.27020.11540.11520.11500.1146
3-1.3909-0.76673.84261.1925-4.3719-1.94561.93460.587814.76551.422119.11333.7852-0.89840.5916-0.0087-0.0820-1.5138-0.672245.32070.12130.00350.116219.824535.37840010000000304.55600.11530.11480.11400.1129
4-1.6729-0.44913.68991.0493-4.1512-1.95792.79840.201713.61521.101017.23243.8335-0.28190.3176-0.1527-0.14320.2207-0.01244.68890.03440.14480.44670.39650.05290001000000305.13320.11520.11420.11270.1105
5-1.77161.22473.43421.0013-3.4948-2.17753.13841.499911.79371.002612.21364.7416-0.09871.6738-0.2557-0.04800.6564-0.21960.65280.98310.48280.02533.63424.10310000100000305.49810.11500.11340.11090.1074
6-2.1816-1.78072.78101.6438-2.9914-2.46844.75933.17107.73382.70228.94836.0932-0.4100-3.0054-0.65320.64250.5034-0.29099.69823.20233.643012.46492.12616.99000000010000306.53110.11470.11240.10860.1034
7-2.20710.19212.38101.6966-2.1391-2.33924.87130.03695.66932.87844.57605.4721-0.02551.9728-0.39990.05270.85220.12920.07071.36701.28890.14366.15120.99410000001000307.60500.11440.11120.10600.0988
8-1.9208-0.25821.88761.8703-1.5973-2.05343.68950.06673.56293.49812.55134.21630.2863-0.4503-0.49350.17380.54190.28594.17880.07342.01901.05192.46745.54520000000100307.45310.11400.10980.10290.0934
9-1.65320.10571.27911.9866-0.3026-1.65572.73310.01121.63603.94640.09162.74120.26760.3639-0.60850.11621.29470.39773.63210.04543.14030.515914.262311.04790000000010308.45060.11360.10820.09940.0874
10-1.39000.76090.58951.9495-0.2146-1.57761.93220.57900.34753.80060.04612.48890.26320.6552-0.6896-0.03700.08800.07803.50710.14914.07900.01020.05800.30640000000000307.54550.11320.10640.09550.0808
11-1.4473-1.05711.06892.0610-0.0224-1.50402.09471.11741.14254.24775.0229e-042.2621-0.0573-1.81800.47940.11150.19220.07360.25101.17452.40090.48000.29850.26560000000000307.80150.11270.10450.09120.0736
12-1.4445-0.05200.81841.8435-0.2637-1.67272.08650.00270.66993.39860.06952.79780.00281.0051-0.2504-0.2175-0.2413-0.16870.00310.35290.46091.13420.52392.50990000000000307.51040.11210.10230.08660.0659
13-1.4448-1.69691.16741.9769-0.1672-1.55922.08752.87961.36293.90800.02792.4312-3.3265e-04-1.64500.34900.13330.09650.11340.00630.96221.32550.65560.07070.74050000000000307.27520.11150.10000.08160.0577
14-1.02110.43631.01261.8334-0.0398-1.36481.04270.19031.02543.36120.00161.86280.42372.1332-0.1548-0.14350.12730.19449.37571.59910.14970.44870.12692.43930000000000307.66250.11090.09750.07640.0492
15-1.0815-1.51800.80081.9916-0.2434-1.32201.16972.30430.64133.96650.05921.7478-0.0604-1.9542-0.21180.1582-0.20350.04280.27481.35660.31480.88870.37610.06160000000000307.87230.11020.09480.07080.0402
16-0.94270.20210.82531.7012-0.1798-1.30060.88860.04090.68122.89410.03231.69150.13891.72010.0245-0.29040.06360.02150.90641.03850.02582.11640.02870.00400000000000307.27740.10940.09200.06490.0311
17-1.0518-2.36480.93151.7947-0.5156-1.34571.10635.59240.86783.22080.26581.8109-0.1091-2.56700.10620.0935-0.3358-0.04510.78352.33760.16820.35601.00190.26400000000000308.10520.10860.08900.05880.0216
18-0.97930.14660.70871.5625-0.2750-1.39650.95910.02150.50222.44150.07561.95020.07242.5114-0.2229-0.23210.2406-0.05080.21162.21810.35371.30720.47330.31690000000000307.74620.10780.08580.05240.0121
19-1.1525-1.73270.86601.7382-0.1222-1.35441.32833.00230.74993.02140.01491.8343-0.1732-1.87930.15730.17570.15290.04221.84821.25480.32031.07320.18570.05890000000000308.63040.10690.08250.04590.0024
20-0.97041.11890.92381.17740.0248-1.39630.94161.25200.85341.38626.1376e-041.94980.18212.85160.0578-0.56090.1469-0.04201.61932.86130.06888.41070.17110.23680000000000307.78250.10600.07900.0391-0.0073
21-1.0712-1.78731.23901.45870.0224-1.32571.14753.19461.53512.12774.9993e-041.7575-0.1009-2.90630.31520.2813-0.00240.07070.67882.99491.09852.56135.7538e-040.23970000000000307.27810.10500.07550.0322-0.0169
22-1.04410.30211.10841.11740.2283-1.35381.09010.09131.22871.24860.05211.83280.02722.0895-0.1306-0.34130.2059-0.02810.01551.53400.09792.98080.34390.13420000000000307.23650.10400.07170.0252-0.0264
23-1.0828-1.36471.08291.2542-0.1219-1.35041.17241.86241.17261.57300.01491.8237-0.0387-1.6668-0.02560.1368-0.35020.00340.13220.98795.9081e-050.68581.08790.00870000000000307.13690.10290.06790.0181-0.0357
24-1.03440.99191.34790.79240.8439-1.40291.07000.98391.81680.62800.71221.96820.04842.35660.2650-0.46180.9658-0.05250.07951.95250.80085.61917.91340.33360000000000307.24420.10180.06390.0109-0.0447
25-1.0897-0.35521.39660.64230.8484-1.48501.18740.12621.95040.41250.71972.2053-0.0553-1.34710.0487-0.15020.0045-0.08210.23640.64630.05490.49751.4617e-050.69560000000000306.87990.10060.05980.0036-0.0535
26-1.21110.26731.40660.40790.9087-1.53021.46690.07141.97860.16640.82572.3415-0.12150.62250.0101-0.23440.0603-0.04520.95370.13450.01361.33500.02550.26460000000000307.62890.09940.0556-0.0036-0.0619
27-1.3604-0.97281.10720.54130.4343-1.56701.85080.94631.22590.29300.18862.4555-0.1493-1.2400-0.29940.1334-0.4744-0.03681.39900.54800.68620.65611.97930.19500000000000307.72750.09810.0513-0.0109-0.0698
28-1.3980-0.42461.16640.69570.3385-1.47611.95430.18031.36060.48400.11462.1790-0.03750.54820.05920.1544-0.09580.09090.12580.10400.07110.85060.08860.44180000000000307.00740.09680.0470-0.0181-0.0773
29-1.4148-0.00660.76340.66980.6300-1.46562.00174.4017e-050.58280.44860.39702.1479-0.01680.4179-0.4030-0.02600.29150.01060.04060.06011.31050.00170.70129.5826e-040000000000307.66680.09550.0425-0.0252-0.0842
30-1.3870-1.62631.18170.80750.5517-1.41781.92392.64471.39630.65210.30432.01010.0278-1.61960.41830.1378-0.07840.04780.01670.93291.85710.69470.06080.08500000000000306.75770.09410.0380-0.0322-0.0905
31-1.24900.87040.41100.80720.6715-1.34241.56010.75750.16890.65160.45091.80200.13802.4966-0.7706-3.5897e-040.11980.07540.89392.19205.14000.00910.11170.28150000000000307.44280.09270.0334-0.0391-0.0962
32-1.1904-1.97130.67691.04620.4465-1.14681.41703.88600.45811.09460.19941.31520.0587-2.84170.26580.2391-0.22500.19560.12812.86340.80541.88950.45712.47220000000000306.71240.09120.0287-0.0459-0.1012
33-1.1050-0.06250.55360.97040.8620-0.98981.22110.00390.30650.94160.74310.97970.08541.9088-0.1233-0.07590.41550.15700.30871.27950.08440.09511.44151.53330000000000307.09890.08970.0240-0.0524-0.1055
34-1.1165-0.60990.30831.00950.8551-0.96071.24650.37200.09501.01910.73110.9230-0.0114-0.5473-0.24530.0391-0.00700.02900.02600.10800.44000.09380.00140.01660000000000307.13040.08820.0193-0.0588-0.1090
35-1.2300-0.18670.31140.92680.9033-0.99531.51280.03490.09700.85900.81590.9905-0.11350.42310.0031-0.08270.0482-0.03450.84190.06160.00910.11880.01550.17790000000000307.35050.08660.0145-0.0649-0.1118
36-1.1763-0.84700.07900.92371.0509-0.94601.38370.71750.00620.85321.10450.89480.0537-0.6603-0.2324-0.00310.14770.04930.10290.15660.38910.00650.17290.09280000000000307.59160.08500.0097-0.0708-0.1139
37-1.1502-0.80740.42290.96330.9022-0.94071.32290.65190.17890.92800.81400.88500.02610.03970.34400.0396-0.14870.00520.01364.1161e-041.29030.09550.20490.00600000000000307.02710.08330.0048-0.0764-0.1151
38-1.0346-1.22400.42200.93130.8627-0.80241.07031.49830.17810.86730.74430.64390.1156-0.4167-9.2699e-04-0.0320-0.03950.13830.60820.06300.00690.00550.01761.15730000000000307.80260.08167.0705e-18-0.0816-0.1155
39-0.9694-0.81170.02610.81040.9235-0.79520.93970.65886.8067e-040.65670.85290.63230.06520.4124-0.3959-0.12090.06080.00720.16500.05851.26130.30140.02600.00360000000000307.36780.0799-0.0048-0.0866-0.1151
40-0.97680.00410.17420.80550.9845-0.78150.95411.6495e-050.03040.64880.96920.6107-0.00740.81570.1481-0.00490.06100.01370.01740.23190.28950.00500.02611.3407e-050000000000307.42130.0782-0.0097-0.0912-0.1139
41-1.0060-0.9430-0.23501.14741.3180-0.74511.01190.88920.05521.31661.73720.5552-0.0292-0.9470-0.40920.34190.33350.03640.08570.32051.35423.70300.92230.03710000000000307.91250.0764-0.0145-0.0955-0.1118
42-1.0515-0.61140.10020.89021.1292-0.69531.10560.37380.01000.79241.27520.4834-0.04550.33160.3352-0.2572-0.18880.04980.17130.03761.23041.63220.32490.09560000000000306.66220.0745-0.0193-0.0994-0.1090
43-0.9759-0.8806-0.27550.93831.1810-0.67630.95240.77540.07590.88041.39470.45740.0756-0.2692-0.37570.04810.05170.01900.23340.02671.12660.12550.01810.00170000000000306.74510.0727-0.0240-0.1029-0.1055
44-0.9492-0.2312-0.15480.83501.3329-0.62820.90100.05350.02400.69721.77670.39460.02670.64940.1207-0.10330.15200.04810.01460.14640.20640.20690.18350.08670000000000306.50110.0708-0.0287-0.1060-0.1012
45-0.8582-0.7133-0.37081.03571.4401-0.58810.73650.50890.13751.07282.07400.34590.0910-0.4821-0.21600.20080.10720.04010.35690.08400.32931.36870.08830.05050000000000306.87280.0688-0.0334-0.1086-0.0962
46-0.47650.2605-0.29880.91241.3659-0.36520.22710.06790.08930.83251.86570.13340.38170.97390.0720-0.1233-0.07420.22297.56620.33120.09340.31570.05493.27230000000000306.91120.0669-0.0380-0.1109-0.0905
47-0.7065-1.7602-0.37750.83141.0722-0.31130.49923.09840.14250.69121.14960.0969-0.2300-2.0208-0.0787-0.0811-0.29370.05393.16991.45030.02390.11300.77010.11890000000000307.52700.0649-0.0425-0.1127-0.0842
48-0.76101.1148-0.73010.70771.6592-0.39640.57921.24280.53310.50082.75310.1572-0.05452.8750-0.3526-0.12370.5871-0.08520.23102.90850.98190.31772.90090.74080000000000307.24190.0629-0.0470-0.1140-0.0773
49-0.7281-1.6329-0.48560.81471.2132-0.36020.53012.66650.23580.66381.47180.12970.0329-2.74770.24450.1070-0.44610.03620.02802.67760.69280.44761.75270.03670000000000307.18170.0608-0.0513-0.1150-0.0698
50-0.7983-0.7298-0.35510.85791.2536-0.34500.63730.53260.12610.73601.57160.1190-0.07020.90310.13050.04320.04040.01520.35600.28460.23440.10760.01038.6929e-050000000000307.16580.0588-0.0556-0.1154-0.0619
51-0.76960.8510-0.57950.51121.1874-0.41830.59220.72420.33580.26141.40990.17490.02871.5808-0.2244-0.3467-0.0662-0.07330.01850.87660.35923.08220.04450.57440000000000307.20840.0567-0.0598-0.1154-0.0535
52-0.8076-1.4416-0.18700.59820.6927-0.36160.65222.07830.03500.35790.47990.1307-0.0380-2.29260.39250.0870-0.49470.05670.12841.86561.64930.31582.15020.13580000000000306.77020.0546-0.0639-0.1150-0.0447
53-0.73241.0213-0.25280.29840.7159-0.43150.53651.04300.06390.08910.51250.18620.07512.4629-0.0659-0.29980.0232-0.07000.23042.13300.01332.26480.00260.53140000000000306.37190.0524-0.0679-0.1140-0.0357
54-0.8272-1.2096-0.37660.54440.5031-0.37220.68421.46320.14180.29640.25310.1385-0.0947-2.2309-0.12370.2460-0.21280.05930.60621.76670.08531.99310.41010.15320000000000306.77210.0503-0.0717-0.1127-0.0264
55-0.76180.1559-0.38520.49530.7837-0.34300.58040.02430.14830.24530.61410.11760.06531.3655-0.0086-0.04910.28060.02930.16590.65330.00350.02730.64830.01710000000000306.80430.0481-0.0755-0.1109-0.0169
56-0.7725-0.7753-0.60200.57430.7974-0.33390.59680.60110.36240.32980.63590.1115-0.0107-0.9312-0.21690.07900.01380.00910.02430.30990.33220.26975.4701e-040.00190000000000307.47890.0459-0.0790-0.1086-0.0073
57-0.74280.9315-0.30540.51790.8232-0.35870.55180.86770.09330.26820.67770.12870.02971.70680.2966-0.05640.0258-0.02490.02051.02230.98270.04180.00340.11440000000000307.24440.0436-0.0825-0.10600.0024
58-0.61510.7270-0.48490.55130.5501-0.33530.37840.52850.23510.30390.30260.11240.1277-0.2045-0.17950.0334-0.27310.02350.75560.01560.21360.07600.66770.00650000000000307.46660.0414-0.0858-0.10290.0121
59-0.7292-0.5376-0.18170.53840.3592-0.30410.53170.28900.03300.28990.12900.0925-0.1141-1.26460.3032-0.0129-0.19090.03110.84940.56981.02327.9828e-040.33220.02160000000000306.87700.0391-0.0890-0.09940.0216
60-0.6802-0.0363-0.46810.17260.4995-0.29020.46270.00130.21910.02980.24950.08420.04890.5013-0.2864-0.36580.14030.01390.08170.08680.62213.45060.15554.5039e-060000000000306.37560.0368-0.0920-0.09550.0311
61-0.5985-0.2757-0.14560.14840.3506-0.26460.35820.07600.02120.02200.12290.07000.0818-0.23940.3225-0.0242-0.14890.02560.27980.02121.14580.00110.20540.00990000000000306.84160.0345-0.0948-0.09120.0402
62-0.5003-0.5836-0.54420.19000.3856-0.22150.25030.34050.29620.03610.14870.04910.0982-0.3079-0.39860.04150.03500.04300.42300.03471.27990.10190.00730.06270000000000308.00070.0322-0.0975-0.08660.0492
63-0.33951.1750-0.67940.22550.4268-0.14620.11531.38070.46160.05090.18220.02140.16081.7586-0.13520.03560.04120.07531.24251.08560.10700.08250.01080.28090000000000307.91360.0299-0.1000-0.08160.0577
64-0.2553-0.7115-0.15060.0289-0.2784-0.01250.06520.50630.02278.3559e-040.07751.5653e-040.0842-1.88660.5288-0.1966-0.70520.13370.29921.26462.89090.90954.34011.07350000000000307.95340.0275-0.1023-0.07640.0659
65-0.03101.7934-0.3541-0.1129-0.0376-0.05179.6136e-043.21620.12540.01270.00140.00270.22432.5049-0.2034-0.14180.2408-0.03922.51182.20660.28660.43650.47430.21370000000000307.11340.0252-0.1045-0.07080.0736
66-0.0879-1.37670.11410.14950.38650.05320.00771.89540.01300.02230.14940.0028-0.0569-3.17010.46820.26240.42400.10490.24793.56222.29592.24741.50200.61820000000000307.15710.0228-0.1064-0.06490.0808
67-0.06411.0069-0.2714-0.09890.75630.01260.00411.01390.07370.00980.57191.5973e-040.02372.3837-0.3855-0.24830.3698-0.04050.00981.99771.19111.51241.13770.22470000000000306.55190.0204-0.1082-0.05880.0874
680.0564-0.5697-0.0097-0.02290.42440.09830.00320.32459.4904e-055.2289e-040.18010.00970.1205-1.57660.26170.0760-0.33180.08570.66600.88420.78270.25320.97860.38440000000000306.53940.0181-0.1098-0.05240.0934
690.02040.4204-0.2466-0.16550.36330.09774.1759e-040.17670.06080.02740.13200.0095-0.03590.9901-0.2369-0.1427-0.0611-6.3561e-040.11760.34240.40630.44250.03840.01640000000000306.77760.0157-0.1112-0.04590.0988
700.12850.17410.1670-0.06690.48190.24050.01650.03030.02790.00450.23220.05790.1081-0.24630.41360.09870.11850.14280.52450.02241.81850.38980.10921.24360000000000307.11850.0133-0.1124-0.03910.1034
710.26081.8590-0.0849-0.21120.47270.18020.06803.45590.00720.04460.22350.03250.13231.6849-0.2519-0.1444-0.0091-0.06040.81550.99620.46710.45480.00190.41720000000000306.96830.0109-0.1134-0.03220.1074
720.1306-0.51000.3490-0.05400.17990.28830.01710.26010.12180.00290.03240.0831-0.1302-2.36900.43390.1573-0.29280.10821.08401.99161.99000.87880.76520.66370000000000306.94330.0085-0.1142-0.02520.1105
730.15602.0718-0.0655-0.18300.83810.28820.02434.29250.00430.03350.70230.08310.02542.5818-0.4145-0.12910.6581-1.0939e-040.01242.34451.39160.35123.65360.01530000000000306.29160.0060-0.1148-0.01810.1129
740.22420.00740.3498-0.02640.62780.44250.05035.5104e-050.12246.9747e-040.39410.19580.0683-2.06440.41530.1566-0.21030.15430.18401.51351.83220.87270.40071.47410000000000306.21620.0036-0.1152-0.01090.1146
750.24240.8049-0.1480-0.13030.64750.46110.05870.64780.02190.01700.41920.21260.01810.7974-0.4978-0.10390.01970.01860.00330.22152.05690.20990.00170.00150000000000306.87540.0012-0.1154-0.00360.1154
760.32600.02880.1366-0.32190.95680.49760.10638.3178e-040.01870.10360.91550.24760.0837-0.77600.2846-0.19150.30930.03650.29500.21580.91140.85840.79110.03760000000000307.2279-0.0012-0.11540.00360.1154
770.2971-0.73830.1065-0.13050.53420.60400.08830.54510.01130.01700.28540.3648-0.0289-0.7672-0.03000.1913-0.42260.10640.08470.21093.5732e-051.25331.57520.63870000000000307.0431-0.0036-0.11520.01090.1146
780.25730.67650.2551-0.23600.61810.62080.06620.45770.06510.05570.38210.3854-0.03971.41490.1486-0.10550.08390.01680.13770.70160.29090.21760.05245.2123e-040000000000306.7590-0.0060-0.11480.01810.1129
790.26610.8164-0.0888-0.33430.62370.52140.07080.66650.00790.11180.38900.27190.00870.1398-0.3439-0.09830.0056-0.09931.4538e-040.00640.92950.18332.5404e-070.96730000000000306.1418-0.0085-0.11420.02520.1105
800.1961-0.74660.2411-0.16320.56350.57630.03850.55740.05810.02660.31750.3321-0.0700-1.56290.32980.1711-0.06020.05480.35420.86901.19411.02330.03740.12430000000000307.1658-0.0109-0.11340.03220.1074
810.24951.82330.0256-0.46400.80270.50480.06233.32446.5679e-040.21530.64430.25480.05342.5699-0.2154-0.30080.2392-0.07150.10192.32280.32722.28170.46780.55070000000000306.6479-0.0133-0.11240.03910.1034
820.2740-0.44730.0252-0.09650.67560.55810.07510.20016.3720e-040.00930.45640.31150.0245-2.2706-3.8511e-040.3675-0.12710.05330.01091.83000.00724.24790.15160.11500000000000306.6813-0.0157-0.11120.04590.0988
830.33441.2379-0.0662-0.31620.82510.56200.11181.53240.00440.10000.68080.31580.06041.6852-0.0914-0.21970.14950.00390.13750.99650.03741.15920.17750.00790000000000306.2578-0.0181-0.10980.05240.0934
840.3607-0.0748-0.0048-0.09520.26700.66110.13010.00562.2789e-050.00910.07130.43710.0263-1.31270.06140.2210-0.55810.09920.01400.61380.07471.63362.72930.54270000000000307.4403-0.0204-0.10820.05880.0874
850.30790.00690.1011-0.23400.54000.70920.09484.7092e-050.01020.05480.29160.5030-0.05280.08170.1059-0.13890.27290.04810.21880.00200.16740.41600.61280.08660000000000307.4911-0.0228-0.10640.06490.0808
860.30770.4616-0.6051-0.30070.59910.53560.09470.21300.36610.09040.35890.2868-2.5291e-040.4547-0.7062-0.06670.0591-0.17370.00620.07134.28640.06720.02442.64930000000000307.6060-0.0252-0.10450.07080.0736
870.3447-0.5659-0.2581-0.20290.82850.66520.11880.32020.06660.04120.68650.44250.0370-1.02750.34690.09780.22950.12960.03890.37691.31100.38410.42971.00080000000000307.4220-0.0275-0.10230.07640.0659
880.53361.3698-0.6333-0.17450.92310.61590.28481.87630.40110.03050.85200.37930.18901.9357-0.37520.02840.0945-0.04931.75061.31591.12290.06190.06760.30210000000000307.3234-0.0299-0.10000.08160.0577
890.3880-1.0879-0.0075-0.33930.62120.69400.15061.18365.5937e-050.11510.38590.4816-0.1456-2.45770.6258-0.1648-0.30190.07811.33492.14323.98580.61400.81260.30660000000000307.3933-0.0322-0.09750.08660.0492
900.45131.1389-0.5129-0.44780.81960.61480.20371.29720.26310.20050.67180.37800.06332.2269-0.5054-0.10850.1984-0.07920.15371.74302.12390.23280.31870.65420000000000306.9555-0.0345-0.09480.09120.0402
910.5830-0.4225-0.0878-0.13550.56670.75320.33990.17850.00770.01840.32110.56740.1317-1.56140.42510.3123-0.25290.13850.80780.86731.91423.11830.57461.16050000000000306.6701-0.0368-0.09200.09550.0311
920.64982.0793-0.3219-0.58460.72910.61830.42224.32340.10360.34180.53160.38230.06682.5018-0.2340-0.44910.1624-0.13500.17472.20110.39545.30290.21061.67020000000000306.1144-0.0391-0.08900.09940.0216
930.6292-1.0838-0.1902-0.39150.59350.72520.39581.17470.03620.15330.35220.5259-0.0206-3.16310.13170.1931-0.13560.10690.05263.54650.23791.27450.17160.64620000000000307.1661-0.0414-0.08580.10290.0121
940.63381.7600-0.6669-0.72710.38530.62870.40173.09760.44480.52860.14840.39520.00472.8438-0.4767-0.3355-0.2082-0.09650.00182.84561.87622.87600.39300.91970000000000307.0040-0.0436-0.08250.10600.0024
950.6905-0.6154-0.3629-0.42250.25420.76160.47680.37870.13170.17850.06460.58010.0567-2.37540.30400.3045-0.13100.13300.11792.00241.02812.97400.16071.06020000000000308.0440-0.0459-0.07900.1086-0.0073
960.71470.1543-0.2634-0.58980.37800.83650.51070.02380.06940.34790.14290.69980.02410.76970.0996-0.16730.12370.07490.01040.20630.15190.63500.11950.27710000000000307.7005-0.0481-0.07550.1109-0.0169
970.58861.1120-0.2122-0.77890.61280.74830.34651.23660.04500.60660.37560.5599-0.12600.95770.0512-0.18900.2349-0.08831.02070.32020.05860.83380.45060.78780000000000307.6162-0.0503-0.07170.1127-0.0264
980.6122-1.2711-0.1496-0.60990.11270.84460.37481.61580.02240.37200.01270.71330.0235-2.38310.06260.1689-0.50010.09630.00952.01540.07660.99952.19710.50660000000000307.3954-0.0524-0.06790.1140-0.0357
990.58481.3089-0.1723-0.72590.61550.73670.34201.71330.02970.52690.37880.5427-0.02732.5801-0.0226-0.11590.5027-0.10790.07802.34132.7627e-040.27292.12041.11900000000000306.7732-0.0546-0.06390.1150-0.0447
1000.7015-0.3059-0.3461-0.62620.13760.70900.49210.09360.11980.39210.01890.50260.1166-1.6149-0.17390.0997-0.4778-0.02770.61990.92750.19810.39642.00790.13150000000000307.5246-0.0567-0.05980.1154-0.0535
 
obj_denoised = enforce_variable_types(obj_denoised);
% save the cleaned file in the parent folder using the filename root:
[dd, ff, ee] = fileparts(obj_denoised.fullpath(1, :));
[~, fn] = fileparts(ff);
fn = [fn '_denoised.mat'];
save(fullfile(dd, fn), 'obj_denoised');

A detailed overview of each step

Step 1. Set Up Your Environment

1. Download and Install CANLAB Toolboxes:
2. Prepare Your Inputs:

Step 2. Create the fmri_data Object

The fmri_data object in CANLAB is a container that holds your fMRI data along with metadata and processing options. We will do this by loading a NIFTI (.nii) file with smoothed, warped, realigned fMRI time series images from a sample run.
% Load the key 4-D image file
 
fname = which('swrsub-sid001567_task-pinel_acq-s1p2_run-03_bold.nii.gz');
obj = fmri_data(fname);
Using default mask: /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 145720800 bytes Loading image number: 150 Elapsed time is 0.460028 seconds. Image names entered, but fullpath attribute is empty. Getting path info. .fullpath should have image name for each image column in .dat Attempting to expand image filenames in case image list is unexpanded 4-D images Number of unique values in dataset: 493 Bit rate: 8.95 bits Warning: Number of unique values in dataset is low, indicating possible restriction of bit rate. For comparison, Int16 has 65,536 unique values
A more in-depth explanation is below.

Sample data

Orientation to Pinel data files

The Pinel Localizer task was designed to probe several different types of basic cognitive processes, such as visual perception, finger tapping, language, and math. Several of the tasks are cued by reading text on the screen (i.e., visual modality) and also by hearing auditory instructions (i.e., auditory modality). The trials are randomized across conditions and have been optimized to maximize efficiency for a rapid event related design. There are 100 trials in total over a 5-minute scanning session. Read the original paper for more specific details about the task and the dataset paper.
This dataset is well suited for these tutorials as it is (a) publicly available to anyone in the world, (b) relatively small (only about 5min), and (c) provides many options to create different types of contrasts. There are a total of 94 subjects available.
Our Pinel_data_sample_subject is from an individual collected at Dartmouth's Brain Imaging Center (DBIC). It is organized in a particular standardized file format called BIDS (Brain imaging Data structure). The whole dataset is available in BIDS format from Luke Chang's g-node GIN repository.
To have a look at this, let's go to the Pinel_data_sample_subject folder. Drag and drop it into your Command Window, or drag the folder into Terminal (Mac) and copy the path, then use the cd( ) command in Matlab. e.g.,
% This works for me, but you can't copy it exactly unless you have my laptop! Which i hope is not the case.
cd('/Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/Sample_datasets/Pinel_sample_fMRI_time_series')
Now, let's look at the files:
ls % list files
mwc1sub-sid001567_acq-MPRAGE_T1w.nii rp_sub-sid001567_task-pinel_acq-s1p2_run-03_bold.txt sub-sid001567_task-pinel_acq-s1p2_run-03_bold.json sub-sid001567_task-pinel_acq-s1p2_run-03_bold_full_design_matrix.png sub-sid001567_task-pinel_acq-s1p2_run-03_events.tsv swrsub-sid001567_task-pinel_acq-s1p2_run-03_bold.nii.gz swrsub-sid001567_task-pinel_acq-s1p2_run-03_bold_denoised.mat
 
The main files we're interested in are:
sub-sid001567_task-pinel_acq-s1p2_run-03_bold.nii
The image data in 4-D Nifti format
sub-sid001567_task-pinel_acq-s1p2_run-03_events.tsv
The task events + their onset times
The rp_.txt file is only created after realignment of the functional images, a preprocessing step. We'll assume this is done already for now (which it was for this sample participant).
After realignment with SPM software (or similar), some new files are created:
rp_sub-sid001567_task-pinel_acq-s1p2_run-03_bold.txt
The "realignment parameters" (rp), head motion estimates, with translation and rotation for each image required to match it to the reference image (often the first image in the series or an average image)
sub-sid001567_task-pinel_acq-s1p2_run-03_bold.mat
Matlab transformation matrices describing the voxel sizes, origin (zero-coordinate), and rotation for each image
rsub-sid001567_task-pinel_acq-s1p2_run-03_bold.nii
The realigned image data, with the transformations (i.e., rotation/translation) applied
swrsub-sid001567_task-pinel_acq-s1p2_run-03_bold.nii.gz
Smoothed (s), warped to MNI template (w), and realigned (r) 4-D image series. This is the one we are going to load and use for this example.
To construct a design matrix for first-level analysis (see below), we're mainly interested in two files: The task (.tsv) file that tells us how to construct the regressors of interest, and the rp*.txt file that we'll use as a set of nuisance covariates.
For further reading and information on file specifications, see the docs on fmriprep preprocessing, or this or this.

Step 3. Build the Nuisance Covariate Model

The goal is to create a design matrix that captures nuisance variance from multiple sources. This matrix typically includes:
1. Intercepts: Use intercept_model.m to generate indicator matrices for each run or session.
This example dataset only includes one run, so we will omit it here, but it is important to include for multi-run data.
2. Motion Parameters: Extract the 24 motion parameters per run (e.g., translations, rotations, and their derivatives/squares) from your fmriprep or SPM outputs.
% 24 movement-related covariates per run
mvmtfname = which('rp_sub-sid001567_task-pinel_acq-s1p2_run-03_bold.txt');
[mvmt_matrix, mvmt_regs_24] = movement_regressors(mvmtfname);
 
covs = mvmt_regs_24;
 
Let's plot them:
figure; plot(mvmt_matrix);
legend({'x' 'y' 'z' 'roll' 'pitch' 'yaw'});
title('Movement regressors')
3. Mean CSF Signal: Use either the fmriprep output or the CANLAB function:FD = FD.extract_gray_white_csf();
% Mean CSF
[gwcsfvalues, gwcsfcomponents] = extract_gray_white_csf(obj);
Extracting from gray_matter_mask_sparse.img. Removing 2565 voxels with one or more NaNs Extracting from canonical_white_matter.img. Removing 106 voxels with one or more NaNs Extracting from canonical_ventricles.img. Removing 158 voxels with one or more NaNs
meancsf = gwcsfvalues(:, 3);
covs = [covs meancsf];
This extracts average signals from CSF (and optionally gray and white matter).
4. Spike Regressors:Identify and flag time points with unusual signal spikes (e.g., using FD.outliers).
5. High Displacement Time Points:Incorporate additional covariates for time points with high head displacement, as measured by geometric displacement metrics from fmriprep.
% 'spike' outliers and high framewise-displacement (fd) images
[est_outliers_uncorr, est_outliers_corr, outlier_tables] = outliers(obj, 'fd', mvmt_matrix);
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | rmssd | Missing values | 0 images Retained 2 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 18.67% Expected 7.50 outside 95% ellipsoid, found 6 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 1 Uncorrected: 6 images Cases 1 2 3 4 5 6 Retained 2 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 22.67% Expected 7.50 outside 95% ellipsoid, found 6 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 1 Uncorrected: 6 images Cases 1 2 3 4 5 6 Mahalanobis (cov and corr, q<0.05 corrected): 1 images Framewise Displacement (before and after >0.50 mm correction): 0 images Outlier_count Percentage _____________ __________ global_mean 6 4 global_mean_to_variance 4 2.6667 missing_values 0 0 rmssd_dvars 1 0.66667 spatial_variability 4 2.6667 mahal_cov_uncor 6 4 mahal_cov_corrected 1 0.66667 mahal_corr_uncor 6 4 mahal_corr_corrected 1 0.66667 fd 0 0 Overall_uncorrected 10 6.6667 Overall_corrected 8 5.3333
sum(est_outliers_uncorr) % this shows how many outliers
ans = 10
 
% each outlier or high-fd image gets its own regressor
covs = [covs outlier_tables.outlier_regressor_matrix_uncorr];
 
6. High-Pass Filter (HPF) Regressors:Generate HPF regressors to remove low-frequency drift.
See also: https://canlab.github.io/_pages/tutorials/html/high_pass_filtering.html
For example, using SPM’s filtering functions:
cutoff = 128; % Example cutoff in seconds; adjust as needed
Note that we need to know the TR for this! It's 2 sec. In BIDS formatted data, this can be found in the ".json sidecar" file, in the "RepetitionTime" field. We also need the scan length in sec, which in this case is 300 sec or 5 min.
json_struct = jsondecode(fileread(which('sub-sid001567_task-pinel_acq-s1p2_run-03_bold.json')))
TR = json_struct.RepetitionTime;
% High-pass filter - TR = 2 sec for this example
[S,KL,KH] = use_spm_filter(TR, size(obj.dat, 2), 'none', 'specify', HP_cutoff_sec);
 
covs = [covs KH];
covs: Combined nuisance regressors into nuisance design matrix X
The various sets of regressors are concatenated into one matrix, covs.
This includes intercept, motion, CSF, spikes, high displacement (movement), HPF matrix

Step 4. Regress Out Nuisance Signals

Now, remove the nuisance variance from each voxel’s time series. The fmri_data.regress method with the 'residual' option performs this operation:
% Regress nuisance signals; output is the residual time series (denoised)
obj_denoised = obj.regress(nuisanceMat, 'residual');
Regress all covs out from each voxel and return residuals
 
% Regress all covs out from each voxel and return residuals
% We can ignore colinearity/leverage warnings
 
obj.X = covs;
regress_output = regress(obj, 'residual', 'grandmeanscale', 'add_voxelwise_intercept', 'noverbose');
obj_denoised = regress_output.resid;
 
% Attach covs for later reference
obj_denoised.covariates = covs;
obj_denoised.metadata_table = cov_table;
 
After this step, obj_denoised holds the denoised 4-D time series for further analysis.
% Optionally, save the design matrix alongside for documentation
save('nuisance_covariates.mat', 'covs');
% Visualize the cleaned data
 
plot(obj_denoised)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values |
Warning: Converting dat field from double to single format
0 images
Warning: Columns of X are linearly dependent to within machine precision.
Using only the first 110 components to compute TSQUARED.
Retained 9 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 52.00% Expected 7.50 outside 95% ellipsoid, found 14 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 14 images Cases 10 19 57 61 87 95 96 97 102 103 128 129 138 140
Warning: Columns of X are linearly dependent to within machine precision.
Using only the first 111 components to compute TSQUARED.
Retained 9 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 50.00% Expected 7.50 outside 95% ellipsoid, found 11 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 11 images Cases 19 51 61 87 96 97 102 103 128 129 144 Mahalanobis (cov and corr, q<0.05 corrected): 0 images Outlier_count Percentage _____________ __________ global_mean 5 3.3333 global_mean_to_variance 5 3.3333 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 3 2 mahal_cov_uncor 14 9.3333 mahal_cov_corrected 0 0 mahal_corr_uncor 11 7.3333 mahal_corr_corrected 0 0 Overall_uncorrected 23 15.333 Overall_corrected 9 6 Compressed NIfTI files are not supported. Compressed NIfTI files are not supported. Compressed NIfTI files are not supported. SPM12: spm_check_registration (v7759) 01:13:48 - 27/03/2025 ======================================================================== Display /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/fmriprep20_template.nii.gz,1 (all) /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/fmriprep20_template.nii.gz,1 /Users/f003vz1/Documents/GitHub/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/fmriprep20_template.nii.gz,1
Grouping contiguous voxels: 1 regions Grouping contiguous voxels: 1 regions Grouping contiguous voxels: 1 regions
ans = 150×1 logical array
0 0 0 0 0 0 0 0 0 1

Step 5. Optional: Explore how nuisance covs overlap with task design

Create a task design matrix from the Pinel task file.
To construct a design matrix for first-level analysis (see below), we're mainly interested in two files: The task (.tsv) file that tells us how to construct the regressors of interest, and the rp*.txt file that we'll use as a set of nuisance covariates, which we have already dealt with.
Load the realignment parameters and create a set of nuisance covariates
% Load the onsets file into a table object in matlab
 
taskdata = readtable('sub-sid001567_task-pinel_acq-s1p2_run-03_events.tsv', 'FileType', 'text');
taskdata
taskdata = 80×3 table
 onsetdurationtrial_type
101'video_computation'
22.40001'video_computation'
38.70001'horizontal_checkerboard'
411.40001'audio_right_hand'
5151'audio_sentence'
6181'video_right_hand'
720.70001'audio_sentence'
823.70001'audio_left_hand'
926.70001'video_left_hand'
1029.70001'audio_sentence'
11331'vertical_checkerboard'
1235.40001'audio_computation'
13391'video_sentence'
1441.70001'video_sentence'
1544.70001'audio_computation'
16481'audio_computation'
1756.40001'video_sentence'
1859.70001'horizontal_checkerboard'
1962.40001'audio_left_hand'
20691'video_right_hand'
2171.40001'video_left_hand'
22751'video_sentence'
2383.40001'audio_computation'
24871'audio_right_hand'
2589.70001'audio_sentence'
26961'vertical_checkerboard'
271081'audio_computation'
28116.70001'video_left_hand'
29119.40001'audio_sentence'
30122.70001'vertical_checkerboard'
31125.40001'video_computation'
32131.40001'video_sentence'
331351'audio_computation'
34137.70001'audio_computation'
35140.40001'vertical_checkerboard'
36143.40001'audio_right_hand'
37146.70001'audio_sentence'
38149.40001'horizontal_checkerboard'
391531'video_computation'
401561'vertical_checkerboard'
411591'video_sentence'
421621'audio_right_hand'
43164.40001'video_computation'
44167.70001'video_sentence'
45170.40001'audio_left_hand'
46173.70001'audio_computation'
47176.70001'horizontal_checkerboard'
48188.40001'horizontal_checkerboard'
49191.70001'audio_computation'
501951'video_sentence'
511981'video_computation'
522011'video_computation'
53203.70001'vertical_checkerboard'
542071'vertical_checkerboard'
552101'vertical_checkerboard'
56212.70001'video_left_hand'
57215.70001'video_left_hand'
58218.70001'horizontal_checkerboard'
59221.40001'video_computation'
60224.70001'horizontal_checkerboard'
61227.70001'video_right_hand'
62230.70001'audio_right_hand'
632341'video_computation'
64236.70001'audio_sentence'
652461'video_sentence'
66248.40001'horizontal_checkerboard'
67251.70001'audio_computation'
68254.70001'audio_left_hand'
69257.40001'audio_left_hand'
70260.40001'video_computation'
712641'vertical_checkerboard'
72266.70001'horizontal_checkerboard'
73269.70001'horizontal_checkerboard'
74275.40001'video_right_hand'
75278.40001'vertical_checkerboard'
76284.40001'audio_sentence'
772881'video_sentence'
782911'video_right_hand'
79293.40001'audio_sentence'
80296.70001'audio_sentence'
 
% Use a CANlab function to extract the conditions (event types) and which
% events belong to each type
[indic, tasknames] = string2indicator(taskdata.trial_type);
indic = logical(indic);
 
% Get a cell array of onsets for each condition
[ons, ons_with_durations] = deal(cell(1, length(tasknames)));
 
for i = 1:length(tasknames)
ons{i} = taskdata.onset(indic(:, i));
ons_with_durations{i} = taskdata.onset(indic(:, i));
ons_with_durations{i}(:, 2) = taskdata.duration(indic(:, i));
end
Now, we've extracted the information in a format we can use to construct a design matrix. Let's try it.
Note that we need to know the TR for this! It's 2 sec. In BIDS formatted data, this can be found in the ".json sidecar" file, in the "RepetitionTime" field. We also need the scan length in sec, which in this case is 300 sec or 5 min.
X = onsets2fmridesign(ons, TR, 300);
 
% let's plot it
plotDesign(ons, [], TR);
This returns the task design matrix, X -- or at least the portion of it of interest. The full design matrix would also include the nuisance covariates.
We can look at the Variance Inflation Factors to see whether there are mulitcolinearity issues or not. We'll use the 'plot' option and save the handle to this figure so we can re-activate it and add things later:
fig_han = create_figure('vifs'); % Get handle to current figure
 
vifs = getvif(X, 0, 'plot');
Variance inflation: 1 (black line) = minimum possible (best) Successive lines indicate doublings of variance inflation factor. Red boxes have extremely high VIFs, perfect multicolinearity
title('Var. inflation factors without nuisance covs')

Now let's see how VIFs are affected by nuisance covs:
fig_han = create_figure('vifs_with_covs'); % Get handle to current figure
 
vifs = getvif([X covs], 0, 'plot');
Variance inflation: 1 (black line) = minimum possible (best) Successive lines indicate doublings of variance inflation factor. Red boxes have extremely high VIFs, perfect multicolinearity
 
% We are interested in the task regs only, so zoom in on those:
set(gca, 'XLim', [0 10], 'YLim', [0 max(10, max(vifs(1:10)) + 0.5)]);
title('Var. inflation factors with nuisance covs')
Attach the onsets and task regressors for later reference.
obj_denoised.additional_info{1} = ons_with_durations;
obj_denoised.additional_info{2} = 'Cell array of onsets (:, 1) and durations (:, 2) for 10 event types';
obj_denoised.additional_info{3} = tasknames;
 
% Add task regressors to the metadata_table table object
t = obj_denoised.metadata_table;
 
tasknames{end + 1} = 'Intercept';
 
% Check that the number of columns in X matches the number of task names
if size(X,2) ~= numel(tasknames)
error('Mismatch: X has %d columns, but tasknames contains %d names.', size(X,2), numel(tasknames));
end
 
% Check that the number of rows in X equals the number of rows in t
if ~isempty(t) && size(X,1) ~= height(t)
error('Row count mismatch: X has %d rows, but table t has %d rows.', size(X,1), height(t));
end
 
% Convert X into a table using tasknames as variable names
task_table = array2table(X, 'VariableNames', tasknames);
 
% Add the new columns to table t
t = [task_table, t];
 
obj_denoised.metadata_table = t;
 

Show the full design matrix

 
obj_denoised.metadata_table
ans = 150×50 table
 audio_computationaudio_left_handaudio_right_handaudio_sentencehorizontal_checkerboardvertical_checkerboardvideo_computationvideo_left_handvideo_right_handvideo_sentenceInterceptmvmt_xmvmt_ymvmt_zmvmt_rollmvmt_pitchmvmt_yawmvmt_x^2mvmt_y^2mvmt_z^2mvmt_roll^2mvmt_pitch^2mvmt_yaw^2mvmt_xdiffmvmt_ydiffmvmt_zdiffmvmt_rolldiffmvmt_pitchdiffmvmt_yawdiffmvmt_xdiff^2mvmt_ydiff^2mvmt_zdiff^2mvmt_rolldiff^2mvmt_pitchdiff^2mvmt_yawdiff^2Out1Out2Out3Out4Out5Out6Out7Out8Out9Out10MeanCSFKH1KH2KH3KH4
100000000001-0.1573-1.19913.29931.2974-1.8213-1.04740.02481.437910.88511.68333.31721.09710000000.00591.0776e-050.00740.00942.8598e-040.01501000000000303.40020.11550.11540.11540.1154
20000000.20570001-0.4925-1.35823.85131.2745-2.8581-1.27340.24261.844814.83271.62428.16851.6215-0.3352-0.15910.5521-0.0229-1.0367-0.22606.55240.00963.13756.5022e-049.33084.33040100000000305.27020.11540.11520.11500.1146
30000000.99680001-1.3909-0.76673.84261.1925-4.3719-1.94561.93460.587814.76551.422119.11333.7852-0.89840.5916-0.0087-0.0820-1.5138-0.672245.32070.12130.00350.116219.824535.37840010000000304.55600.11530.11480.11400.1129
40000001.70700001-1.6729-0.44913.68991.0493-4.1512-1.95792.79840.201713.61521.101017.23243.8335-0.28190.3176-0.1527-0.14320.2207-0.01244.68890.03440.14480.44670.39650.05290001000000305.13320.11520.11420.11270.1105
50000001.47780001-1.77161.22473.43421.0013-3.4948-2.17753.13841.499911.79371.002612.21364.7416-0.09871.6738-0.2557-0.04800.6564-0.21960.65280.98310.48280.02533.63424.10310000100000305.49810.11500.11340.11090.1074
600000.049800.77420001-2.1816-1.78072.78101.6438-2.9914-2.46844.75933.17107.73382.70228.94836.0932-0.4100-3.0054-0.65320.64250.5034-0.29099.69823.20233.643012.46492.12616.99000000010000306.53110.11470.11240.10860.1034
7000.002400.690000.23600001-2.20710.19212.38101.6966-2.1391-2.33924.87130.03695.66932.87844.57605.4721-0.02551.9728-0.39990.05270.85220.12920.07071.36701.28890.14366.15120.99410000001000307.60500.11440.11120.10600.0988
8000.428900.99050-0.04470001-1.9208-0.25821.88761.8703-1.5973-2.05343.68950.06673.56293.49812.55134.21630.2863-0.4503-0.49350.17380.54190.28594.17880.07342.01901.05192.46745.54520000000100307.45310.11400.10980.10290.0934
9000.98540.01750.65810-0.15270001-1.65320.10571.27911.9866-0.3026-1.65572.73310.01121.63603.94640.09162.74120.26760.3639-0.60850.11621.29470.39773.63210.04543.14030.515914.262311.04790000000010308.45060.11360.10820.09940.0874
10000.80230.57470.27780-0.16210001-1.39000.76090.58951.9495-0.2146-1.57761.93220.57900.34753.80060.04612.48890.26320.6552-0.6896-0.03700.08800.07803.50710.14914.07900.01020.05800.30640000000000307.54550.11320.10640.09550.0808
11000.392910.05110-0.126200.205701-1.4473-1.05711.06892.0610-0.0224-1.50402.09471.11741.14254.24775.0229e-042.2621-0.0573-1.81800.47940.11150.19220.07360.25101.17452.40090.48000.29850.26560000000000307.80150.11270.10450.09120.0736
12000.11250.7746-0.05500-0.081000.890801-1.4445-0.05200.81841.8435-0.2637-1.67272.08650.00270.66993.39860.06952.79780.00281.0051-0.2504-0.2175-0.2413-0.16870.00310.35290.46091.13420.52392.50990000000000307.51040.11210.10230.08660.0659
1301.0357e-04-0.02871.0177-0.08810-0.044900.914701-1.4448-1.69691.16741.9769-0.1672-1.55922.08752.87961.36293.90800.02792.4312-3.3265e-04-1.64500.34900.13330.09650.11340.00630.96221.32550.65560.07070.74050000000000307.27520.11150.10000.08160.0577
1400.3110-0.08271.0676-0.08050-0.022100.513601-1.02110.43631.01261.8334-0.0398-1.36481.04270.19031.02543.36120.00161.86280.42372.1332-0.1548-0.14350.12730.19449.37571.59910.14970.44870.12692.43930000000000307.66250.11090.09750.07640.0492
1500.9493-0.08600.6140-0.05720-0.00980.04980.182701-1.0815-1.51800.80081.9916-0.2434-1.32201.16972.30430.64133.96650.05921.7478-0.0604-1.9542-0.21180.1582-0.20350.04280.27481.35660.31480.88870.37610.06160000000000307.87230.11020.09480.07080.0402
1600.8621-0.06580.1917-0.03410-0.00400.69000.003901-0.94270.20210.82531.7012-0.1798-1.30060.88860.04090.68122.89410.03231.69150.13891.72010.0245-0.29040.06360.02150.90641.03850.02582.11640.02870.00400000000000307.27740.10940.09200.06490.0311
1700.4515-0.04150.2788-0.01780-0.00150.9905-0.072701-1.0518-2.36480.93151.7947-0.5156-1.34571.10635.59240.86783.22080.26581.8109-0.1091-2.56700.10620.0935-0.3358-0.04510.78352.33760.16820.35601.00190.26400000000000308.10520.10860.08900.05880.0216
1800.1457-0.02260.8332-0.00830.0175-4.2373e-040.6581-0.088701-0.97930.14660.70871.5625-0.2750-1.39650.95910.02150.50222.44150.07561.95020.07242.5114-0.2229-0.23210.2406-0.05080.21162.21810.35371.30720.47330.31690000000000307.74620.10780.08580.05240.0121
190.0024-0.0136-0.01090.7366-0.00350.574700.2778-0.073301-1.1525-1.73270.86601.7382-0.1222-1.35441.32833.00230.74993.02140.01491.8343-0.1732-1.87930.15730.17570.15290.04221.84821.25480.32031.07320.18570.05890000000000308.63040.10690.08250.04590.0024
200.4289-0.0784-0.00480.3511-0.0014100.0511-0.048801-0.97041.11890.92381.17740.0248-1.39630.94161.25200.85341.38626.1376e-041.94980.18212.85160.0578-0.56090.1469-0.04201.61932.86130.06888.41070.17110.23680000000000307.78250.10600.07900.0391-0.0073
210.9854-0.0877-0.00190.0791-4.9901e-040.72480-0.0550-0.02770.01751-1.0712-1.78731.23901.45870.0224-1.32571.14753.19461.53512.12774.9993e-041.7575-0.1009-2.90630.31520.2813-0.00240.07070.67882.99491.09852.56135.7538e-040.23970000000000307.27810.10500.07550.0322-0.0169
220.8023-0.0696-7.1130e-04-0.051700.32770-0.0881-0.01380.57481-1.04410.30211.10841.11740.2283-1.35381.09010.09131.22871.24860.05211.83280.02722.0895-0.1306-0.34130.2059-0.02810.01551.53400.09792.98080.34390.13420000000000307.23650.10400.07170.0252-0.0264
230.3929-0.04500-0.097800.07710-0.0805-0.00621.31101-1.0828-1.36471.08291.2542-0.1219-1.35041.17241.86241.17261.57300.01491.8237-0.0387-1.6668-0.02560.1368-0.35020.00340.13220.98795.9081e-050.68581.08790.00870000000000307.13690.10290.06790.0181-0.0357
240.1623-0.02500-0.09650-0.04420-0.0572-0.00261.67421-1.03440.99191.34790.79240.8439-1.40291.07000.98391.81680.62800.71221.96820.04842.35660.2650-0.46180.9658-0.05250.07951.95250.80085.61917.91340.33360000000000307.24420.10180.06390.0109-0.0447
250.6613-0.01230-0.07310-0.08630-0.0341-9.7534e-041.18971-1.0897-0.35521.39660.64230.8484-1.48501.18740.12621.95040.41250.71972.2053-0.0553-1.34710.0487-0.15020.0045-0.08210.23640.64630.05490.49751.4617e-050.69560000000000306.87990.10060.05980.0036-0.0535
261.1135-0.00540-0.04640-0.08330-0.0178-3.4755e-040.52861-1.21110.26731.40660.40790.9087-1.53021.46690.07141.97860.16640.82572.3415-0.12150.62250.0101-0.23440.0603-0.04520.95370.13450.01361.33500.02550.26460000000000307.62890.09940.0556-0.0036-0.0619
271.4630-0.00220-0.02550-0.06110-0.008300.10151-1.3604-0.97281.10720.54130.4343-1.56701.85080.94631.22590.29300.18862.4555-0.1493-1.2400-0.29940.1334-0.4744-0.03681.39900.54800.68620.65611.97930.19500000000000307.72750.09810.0513-0.0109-0.0698
281.1267-8.3358e-040-0.01230-0.03740-0.00350-0.09981-1.3980-0.42461.16640.69570.3385-1.47611.95430.18031.36060.48400.11462.1790-0.03750.54820.05920.1544-0.09580.09090.12580.10400.07110.85060.08860.44180000000000307.00740.09680.0470-0.0181-0.0773
290.523200-0.00540-0.01980-0.00140-0.16171-1.4148-0.00660.76340.66980.6300-1.46562.00174.4017e-050.58280.44860.39702.1479-0.01680.4179-0.4030-0.02600.29150.01060.04060.06011.31050.00170.70129.5826e-040000000000307.66680.09550.0425-0.0252-0.0842
300.105100-0.00220-0.00940-4.9901e-040-0.04281-1.3870-1.62631.18170.80750.5517-1.41781.92392.64471.39630.65210.30432.01010.0278-1.61960.41830.1378-0.07840.04780.01670.93291.85710.69470.06080.08500000000000306.75770.09410.0380-0.0322-0.0905
31-0.095100-8.3358e-041.0357e-04-0.00400000.68531-1.24900.87040.41100.80720.6715-1.34241.56010.75750.16890.65160.45091.80200.13802.4966-0.7706-3.5897e-040.11980.07540.89392.19205.14000.00910.11170.28150000000000307.44280.09270.0334-0.0391-0.0962
32-0.15800000.3110-0.00160000.89931-1.1904-1.97130.67691.04620.4465-1.14681.41703.88600.45811.09460.19941.31520.0587-2.84170.26580.2391-0.22500.19560.12812.86340.80541.88950.45712.47220000000000306.71240.09120.0287-0.0459-0.1012
33-0.14780.1060000.9493-5.8679e-040000.55711-1.1050-0.06250.55360.97040.8620-0.98981.22110.00390.30650.94160.74310.97970.08541.9088-0.1233-0.07590.41550.15700.30871.27950.08440.09511.44151.53330000000000307.09890.08970.0240-0.0524-0.1055
34-0.10810.7923000.862100000.21581-1.1165-0.60990.30831.00950.8551-0.96071.24650.37200.09501.01910.73110.9230-0.0114-0.5473-0.24530.0391-0.00700.02900.02600.10800.44000.09380.00140.01660000000000307.13040.08820.0193-0.0588-0.1090
35-0.06650.9642000.451500000.02101-1.2300-0.18670.31140.92680.9033-0.99531.51280.03490.09700.85900.81590.9905-0.11350.42310.0031-0.08270.0482-0.03450.84190.06160.00910.11880.01550.17790000000000307.35050.08660.0145-0.0649-0.1118
36-0.03590.5915000.14570000.0175-0.06681-1.1763-0.84700.07900.92371.0509-0.94601.38370.71750.00620.85321.10450.89480.0537-0.6603-0.2324-0.00310.14770.04930.10290.15660.38910.00650.17290.09280000000000307.59160.08500.0097-0.0708-0.1139
37-0.01730.232100-0.0136000.00240.5747-0.08971-1.1502-0.80740.42290.96330.9022-0.94071.32290.65190.17890.92800.81400.88500.02610.03970.34400.0396-0.14870.00520.01364.1161e-041.29030.09550.20490.00600000000000307.02710.08330.0048-0.0764-0.1151
38-0.00760.028000-0.0784000.42891-0.07741-1.0346-1.22400.42200.93130.8627-0.80241.07031.49830.17810.86730.74430.64390.1156-0.4167-9.2699e-04-0.0320-0.03950.13830.60820.06300.00690.00550.01761.15730000000000307.80260.08167.0705e-18-0.0816-0.1155
39-0.0031-0.064000-0.0877000.98540.7248-0.03591-0.9694-0.81170.02610.81040.9235-0.79520.93970.65886.8067e-040.65670.85290.63230.06520.4124-0.3959-0.12090.06080.00720.16500.05851.26130.30140.02600.00360000000000307.36780.0799-0.0048-0.0866-0.1151
40-9.7534e-04-0.088800-0.0696000.80230.32770.54361-0.97680.00410.17420.80550.9845-0.78150.95411.6495e-050.03040.64880.96920.6107-0.00740.81570.1481-0.00490.06100.01370.01740.23190.28950.00500.02611.3407e-050000000000307.42130.0782-0.0097-0.0912-0.1139
41-3.4755e-04-0.077400-0.0450000.39290.07710.98411-1.0060-0.9430-0.23501.14741.3180-0.74511.01190.88920.05521.31661.73720.5552-0.0292-0.9470-0.40920.34190.33350.03640.08570.32051.35423.70300.92230.03710000000000307.91250.0764-0.0145-0.0955-0.1118
420-0.053300-0.0250000.1125-0.04420.71751-1.0515-0.61140.10020.89021.1292-0.69531.10560.37380.01000.79241.27520.4834-0.04550.33160.3352-0.2572-0.18880.04980.17130.03761.23041.63220.32490.09560000000000306.66220.0745-0.0193-0.0994-0.1090
430.0024-0.031100-0.012300-0.0287-0.08630.32461-0.9759-0.8806-0.27550.93831.1810-0.67630.95240.77540.07590.88041.39470.45740.0756-0.2692-0.37570.04810.05170.01900.23340.02671.12660.12550.01810.00170000000000306.74510.0727-0.0240-0.1029-0.1055
440.4289-0.015900-0.005400-0.0827-0.08330.07591-0.9492-0.2312-0.15480.83501.3329-0.62820.90100.05350.02400.69721.77670.39460.02670.64940.1207-0.10330.15200.04810.01460.14640.20640.20690.18350.08670000000000306.50110.0708-0.0287-0.1060-0.1012
450.9854-0.00730.01750-0.002200-0.0860-0.0611-0.04461-0.8582-0.7133-0.37081.03571.4401-0.58810.73650.50890.13751.07282.07400.34590.0910-0.4821-0.21600.20080.10720.04010.35690.08400.32931.36870.08830.05050000000000306.87280.0688-0.0334-0.1086-0.0962
460.8023-0.00300.57471.0357e-04-8.3358e-0400-0.0658-0.0374-0.08631-0.47650.2605-0.29880.91241.3659-0.36520.22710.06790.08930.83251.86570.13340.38170.97390.0720-0.1233-0.07420.22297.56620.33120.09340.31570.05493.27230000000000306.91120.0669-0.0380-0.1109-0.0905
470.3929-0.001210.3110000-0.0415-0.0198-0.08331-0.7065-1.7602-0.37750.83141.0722-0.31130.49923.09840.14250.69121.14960.0969-0.2300-2.0208-0.0787-0.0811-0.29370.05393.16991.45030.02390.11300.77010.11890000000000307.52700.0649-0.0425-0.1127-0.0842
480.1125-4.2373e-040.72480.9493000-0.0226-0.0094-0.06111-0.76101.1148-0.73010.70771.6592-0.39640.57921.24280.53310.50082.75310.1572-0.05452.8750-0.3526-0.12370.5871-0.08520.23102.90850.98190.31772.90090.74080000000000307.24190.0629-0.0470-0.1140-0.0773
49-0.028700.32770.8621000-0.0109-0.0040-0.03741-0.7281-1.6329-0.48560.81471.2132-0.36020.53012.66650.23580.66381.47180.12970.0329-2.74770.24450.1070-0.44610.03620.02802.67760.69280.44761.75270.03670000000000307.18170.0608-0.0513-0.1150-0.0698
50-0.082700.07710.451500.20570-0.0048-0.0016-0.01981-0.7983-0.7298-0.35510.85791.2536-0.34500.63730.53260.12610.73601.57160.1190-0.07020.90310.13050.04320.04040.01520.35600.28460.23440.10760.01038.6929e-050000000000307.16580.0588-0.0556-0.1154-0.0619
51-0.08600-0.04420.145700.89080-0.0019-5.8679e-04-0.00941-0.76960.8510-0.57950.51121.1874-0.41830.59220.72420.33580.26141.40990.17490.02871.5808-0.2244-0.3467-0.0662-0.07330.01850.87660.35923.08220.04450.57440000000000307.20840.0567-0.0598-0.1154-0.0535
52-0.06580-0.0863-0.013600.91470-7.1130e-040-0.00401-0.8076-1.4416-0.18700.59820.6927-0.36160.65222.07830.03500.35790.47990.1307-0.0380-2.29260.39250.0870-0.49470.05670.12841.86561.64930.31582.15020.13580000000000306.77020.0546-0.0639-0.1150-0.0447
53-0.04150-0.0833-0.078400.5136000-0.00161-0.73241.0213-0.25280.29840.7159-0.43150.53651.04300.06390.08910.51250.18620.07512.4629-0.0659-0.29980.0232-0.07000.23042.13300.01332.26480.00260.53140000000000306.37190.0524-0.0679-0.1140-0.0357
54-0.02260-0.0611-0.087700.1827000-5.8679e-041-0.8272-1.2096-0.37660.54440.5031-0.37220.68421.46320.14180.29640.25310.1385-0.0947-2.2309-0.12370.2460-0.21280.05930.60621.76670.08531.99310.41010.15320000000000306.77210.0503-0.0717-0.1127-0.0264
55-0.01090-0.0374-0.069600.003900001-0.76180.1559-0.38520.49530.7837-0.34300.58040.02430.14830.24530.61410.11760.06531.3655-0.0086-0.04910.28060.02930.16590.65330.00350.02730.64830.01710000000000306.80430.0481-0.0755-0.1109-0.0169
560.20090-0.0198-0.04500-0.072700001-0.7725-0.7753-0.60200.57430.7974-0.33390.59680.60110.36240.32980.63590.1115-0.0107-0.9312-0.21690.07900.01380.00910.02430.30990.33220.26975.4701e-040.00190000000000307.47890.0459-0.0790-0.1086-0.0073
570.88890-0.0094-0.02500-0.088700001-0.74280.9315-0.30540.51790.8232-0.35870.55180.86770.09330.26820.67770.12870.02971.70680.2966-0.05640.0258-0.02490.02051.02230.98270.04180.00340.11440000000000307.24440.0436-0.0825-0.10600.0024
580.91400-0.0040-0.01230-0.073300001-0.61510.7270-0.48490.55130.5501-0.33530.37840.52850.23510.30390.30260.11240.1277-0.2045-0.17950.0334-0.27310.02350.75560.01560.21360.07600.66770.00650000000000307.46660.0414-0.0858-0.10290.0121
590.51360-0.0016-0.00540-0.048800001-0.7292-0.5376-0.18170.53840.3592-0.30410.53170.28900.03300.28990.12900.0925-0.1141-1.26460.3032-0.0129-0.19090.03110.84940.56981.02327.9828e-040.33220.02160000000000306.87700.0391-0.0890-0.09940.0216
600.18270-5.8679e-04-0.00220-0.027700.0498001-0.6802-0.0363-0.46810.17260.4995-0.29020.46270.00130.21910.02980.24950.08420.04890.5013-0.2864-0.36580.14030.01390.08170.08680.62213.45060.15554.5039e-060000000000306.37560.0368-0.0920-0.09550.0311
610.0039000.00160-0.013800.6900001-0.5985-0.2757-0.14560.14840.3506-0.26460.35820.07600.02120.02200.12290.07000.0818-0.23940.3225-0.0242-0.14890.02560.27980.02121.14580.00110.20540.00990000000000306.84160.0345-0.0948-0.09120.0402
62-0.0727000.42890-0.006200.9905001-0.5003-0.5836-0.54420.19000.3856-0.22150.25030.34050.29620.03610.14870.04910.0982-0.3079-0.39860.04150.03500.04300.42300.03471.27990.10190.00730.06270000000000308.00070.0322-0.0975-0.08660.0492
63-0.0887000.985400.047200.6581001-0.33951.1750-0.67940.22550.4268-0.14620.11531.38070.46160.05090.18220.02140.16081.7586-0.13520.03560.04120.07531.24251.08560.10700.08250.01080.28090000000000307.91360.0299-0.1000-0.08160.0577
64-0.0733000.802300.68910.00240.2778001-0.2553-0.7115-0.15060.0289-0.2784-0.01250.06520.50630.02278.3559e-040.07751.5653e-040.0842-1.88660.5288-0.1966-0.70520.13370.29921.26462.89090.90954.34011.07350000000000307.95340.0275-0.1023-0.07640.0659
65-0.0488000.392900.99020.42890.0511001-0.03101.7934-0.3541-0.1129-0.0376-0.05179.6136e-043.21620.12540.01270.00140.00270.22432.5049-0.2034-0.14180.2408-0.03922.51182.20660.28660.43650.47430.21370000000000307.11340.0252-0.1045-0.07080.0736
66-0.0277000.112500.65810.9854-0.0550001-0.0879-1.37670.11410.14950.38650.05320.00771.89540.01300.02230.14940.0028-0.0569-3.17010.46820.26240.42400.10490.24793.56222.29592.24741.50200.61820000000000307.15710.0228-0.1064-0.06490.0808
67-0.013800-0.028700.27780.8023-0.088100.00241-0.06411.0069-0.2714-0.09890.75630.01260.00411.01390.07370.00980.57191.5973e-040.02372.3837-0.3855-0.24830.3698-0.04050.00981.99771.19111.51241.13770.22470000000000306.55190.0204-0.1082-0.05880.0874
68-0.006200-0.082700.05110.3929-0.080500.428910.0564-0.5697-0.0097-0.02290.42440.09830.00320.32459.4904e-055.2289e-040.18010.00970.1205-1.57660.26170.0760-0.33180.08570.66600.88420.78270.25320.97860.38440000000000306.53940.0181-0.1098-0.05240.0934
690.014900-0.08600-0.05500.1125-0.057200.985410.02040.4204-0.2466-0.16550.36330.09774.1759e-040.17670.06080.02740.13200.0095-0.03590.9901-0.2369-0.1427-0.0611-6.3561e-040.11760.34240.40630.44250.03840.01640000000000306.77760.0157-0.1112-0.04590.0988
700.573800-0.06580-0.0881-0.0287-0.034100.802310.12850.17410.1670-0.06690.48190.24050.01650.03030.02790.00450.23220.05790.1081-0.24630.41360.09870.11850.14280.52450.02241.81850.38980.10921.24360000000000307.11850.0133-0.1124-0.03910.1034
711.310700-0.04150-0.0805-0.0827-0.017800.392910.26081.8590-0.0849-0.21120.47270.18020.06803.45590.00720.04460.22350.03250.13231.6849-0.2519-0.1444-0.0091-0.06040.81550.99620.46710.45480.00190.41720000000000306.96830.0109-0.1134-0.03220.1074
721.674200-0.022600.0488-0.0860-0.008300.112510.1306-0.51000.3490-0.05400.17990.28830.01710.26010.12180.00290.03240.0831-0.1302-2.36900.43390.1573-0.29280.10821.08401.99161.99000.87880.76520.66370000000000306.94330.0085-0.1142-0.02520.1105
731.189700.0024-0.010900.7582-0.0658-0.00350-0.028710.15602.0718-0.0655-0.18300.83810.28820.02434.29250.00430.03350.70230.08310.02542.5818-0.4145-0.12910.6581-1.0939e-040.01242.34451.39160.35123.65360.01530000000000306.29160.0060-0.1148-0.01810.1129
740.528600.4289-0.004800.9465-0.0415-0.00140-0.082710.22420.00740.3498-0.02640.62780.44250.05035.5104e-050.12246.9747e-040.39410.19580.0683-2.06440.41530.1566-0.21030.15430.18401.51351.83220.87270.40071.47410000000000306.21620.0036-0.1152-0.01090.1146
750.101500.98540.047900.5832-0.0226-4.9901e-040-0.086010.24240.8049-0.1480-0.13030.64750.46110.05870.64780.02190.01700.41920.21260.01810.7974-0.4978-0.10390.01970.01860.00330.22152.05690.20990.00170.00150000000000306.87540.0012-0.1154-0.00360.1154
76-0.099800.80230.68930.00240.2286-0.010900-0.065810.32600.02880.1366-0.32190.95680.49760.10638.3178e-040.01870.10360.91550.24760.0837-0.77600.2846-0.19150.30930.03650.29500.21580.91140.85840.79110.03760000000000307.2279-0.0012-0.11540.00360.1154
77-0.161700.39290.99050.42890.0266-0.004800-0.041510.2971-0.73830.1065-0.13050.53420.60400.08830.54510.01130.01700.28540.3648-0.0289-0.7672-0.03000.1913-0.42260.10640.08470.21093.5732e-051.25331.57520.63870000000000307.0431-0.0036-0.11520.01090.1146
78-0.148800.11250.65810.9854-0.06450.015600-0.022610.25730.67650.2551-0.23600.61810.62080.06620.45770.06510.05570.38210.3854-0.03971.41490.1486-0.10550.08390.01680.13770.70160.29090.21760.05245.2123e-040000000000306.7590-0.0060-0.11480.01810.1129
79-0.10700-0.02870.27780.8023-0.08880.573900-0.010910.26610.8164-0.0888-0.33430.62370.52140.07080.66650.00790.11180.38900.27190.00870.1398-0.3439-0.09830.0056-0.09931.4538e-040.00640.92950.18332.5404e-070.96730000000000306.1418-0.0085-0.11420.02520.1105
80-0.06490-0.08270.05110.39290.1283100-0.004810.1961-0.74660.2411-0.16320.56350.57630.03850.55740.05810.02660.31750.3321-0.0700-1.56290.32980.1711-0.06020.05480.35420.86901.19411.02330.03740.12430000000000307.1658-0.0109-0.11340.03220.1074
81-0.03440-0.0860-0.05500.11250.83750.7248000.015610.24951.82330.0256-0.46400.80270.50480.06233.32446.5679e-040.21530.64430.25480.05342.5699-0.2154-0.30080.2392-0.07150.10192.32280.32722.28170.46780.55070000000000306.6479-0.0133-0.11240.03910.1034
82-0.01630-0.0658-0.0881-0.02870.88360.3277000.573910.2740-0.44730.0252-0.09650.67560.55810.07510.20016.3720e-040.00930.45640.31150.0245-2.2706-3.8511e-040.3675-0.12710.05330.01091.83000.00724.24790.15160.11500000000000306.6813-0.0157-0.11120.04590.0988
83-0.007000.1642-0.0805-0.08270.49770.077100110.33441.2379-0.0662-0.31620.82510.56200.11181.53240.00440.10000.68080.31580.06041.6852-0.0914-0.21970.14950.00390.13750.99650.03741.15920.17750.00790000000000306.2578-0.0181-0.10980.05240.0934
84-0.002800.8683-0.0572-0.08600.17540.0618000.724810.3607-0.0748-0.0048-0.09520.26700.66110.13010.00562.2789e-050.00910.07130.43710.0263-1.31270.06140.2210-0.55810.09920.01400.61380.07471.63362.72930.54270000000000307.4403-0.0204-0.10820.05880.0874
85-8.3358e-0400.9038-0.0341-0.06588.0733e-040.7061000.327810.30790.00690.1011-0.23400.54000.70920.09484.7092e-050.01020.05480.29160.5030-0.05280.08170.1059-0.13890.27290.04810.21880.00200.16740.41600.61280.08660000000000307.4911-0.0228-0.10640.06490.0808
86000.5088-0.0178-0.0415-0.07390.8809000.388110.30770.4616-0.6051-0.30070.59910.53560.09470.21300.36610.09040.35890.2868-2.5291e-040.4547-0.7062-0.06670.0591-0.17370.00620.07134.28640.06720.02442.64930000000000307.6060-0.0252-0.10450.07080.0736
8700.10600.1808-0.0083-0.0226-0.08910.5304000.905210.3447-0.5659-0.2581-0.20290.82850.66520.11880.32020.06660.04120.68650.44250.0370-1.02750.34690.09780.22950.12960.03890.37691.31100.38410.42971.00080000000000307.4220-0.0275-0.10230.07640.0659
881.0357e-040.79230.0031-0.0035-0.0109-0.07330.1948000.775810.53361.3698-0.6333-0.17450.92310.61590.28481.87630.40110.03050.85200.37930.18901.9357-0.37520.02840.0945-0.04931.75061.31591.12290.06190.06760.30210000000000307.3234-0.0299-0.10000.08160.0577
890.31100.9642-0.0727-0.0014-0.0048-0.04880.0082000.368210.3880-1.0879-0.0075-0.33930.62120.69400.15061.18365.5937e-050.11510.38590.4816-0.1456-2.45770.6258-0.1648-0.30190.07811.33492.14323.98580.61400.81260.30660000000000307.3933-0.0322-0.09750.08660.0492
900.94930.5915-0.0887-4.9901e-040.0479-0.0277-0.0734000.084610.45131.1389-0.5129-0.44780.81960.61480.20371.29720.26310.20050.67180.37800.06332.2269-0.5054-0.10850.1984-0.07920.15371.74302.12390.23280.31870.65420000000000306.9555-0.0345-0.09480.09120.0402
910.86210.2321-0.073300.6893-0.0138-0.092900-0.050910.5830-0.4225-0.0878-0.13550.56670.75320.33990.17850.00770.01840.32110.56740.1317-1.56140.42510.3123-0.25290.13850.80780.86731.91423.11830.57461.16050000000000306.6701-0.0368-0.09200.09550.0311
920.45150.0280-0.048800.9905-0.0062-0.079000-0.098210.64982.0793-0.3219-0.58460.72910.61830.42224.32340.10360.34180.53160.38230.06682.5018-0.2340-0.44910.1624-0.13500.17472.20110.39545.30290.21061.67020000000000306.1144-0.0391-0.08900.09940.0216
930.1457-0.0640-0.027700.6581-0.0026-0.053900-0.097010.6292-1.0838-0.1902-0.39150.59350.72520.39581.17470.03620.15330.35220.5259-0.0206-3.16310.13170.1931-0.13560.10690.05263.54650.23791.27450.17160.64620000000000307.1661-0.0414-0.08580.10290.0121
94-0.0136-0.0888-0.013800.2778-9.7534e-04-0.031100-0.073610.63381.7600-0.6669-0.72710.38530.62870.40173.09760.44480.52860.14840.39520.00472.8438-0.4767-0.3355-0.2082-0.09650.00182.84561.87622.87600.39300.91970000000000307.0040-0.0436-0.08250.10600.0024
95-0.0784-0.0774-0.006200.0511-3.4755e-04-0.015900-0.046610.6905-0.6154-0.3629-0.42250.25420.76160.47680.37870.13170.17850.06460.58010.0567-2.37540.30400.3045-0.13100.13300.11792.00241.02812.97400.16071.06020000000000308.0440-0.0459-0.07900.1086-0.0073
96-0.0877-0.0533-0.002600.05100-0.007300-0.025610.71470.1543-0.2634-0.58980.37800.83650.51070.02380.06940.34790.14290.69980.02410.76970.0996-0.16730.12370.07490.01040.20630.15190.63500.11950.27710000000000307.7005-0.0481-0.07550.1109-0.0169
97-0.0695-0.0311-9.7534e-0400.70430-0.003000-0.012310.58861.1120-0.2122-0.77890.61280.74830.34651.23660.04500.60660.37560.5599-0.12600.95770.0512-0.18900.2349-0.08831.02070.32020.05860.83380.45060.78780000000000307.6162-0.0503-0.07170.1127-0.0264
980.2660-0.0159-3.4755e-0400.88370-0.001200-0.005410.6122-1.2711-0.1496-0.60990.11270.84460.37481.61580.02240.37200.01270.71330.0235-2.38310.06260.1689-0.50010.09630.00952.01540.07660.99952.19710.50660000000000307.3954-0.0524-0.06790.1140-0.0357
990.9243-0.0073000.53430-4.2373e-04000.015310.58481.3089-0.1723-0.72590.61550.73670.34201.71330.02970.52690.37880.5427-0.02732.5801-0.0226-0.11590.5027-0.10790.07802.34132.7627e-040.27292.12041.11900000000000306.7732-0.0546-0.06390.1150-0.0447
1000.8498-0.0030000.198000000.573810.7015-0.3059-0.3461-0.62620.13760.70900.49210.09360.11980.39210.01890.50260.1166-1.6149-0.17390.0997-0.4778-0.02770.61990.92750.19810.39642.00790.13150000000000307.5246-0.0567-0.05980.1154-0.0535
 
create_figure('Full design matrix');
rescale_fcn = @(X) X ./ max(abs(X), [], 1); % rescale columns of X to [1 -1]
X = rescale_fcn(table2array(obj_denoised.metadata_table));
 
imagesc(X);
set(gca, 'YDir', 'Reverse'); axis tight
colormap(colormap_tor([0 0 1], [1 1 0], [.2 .5 1], [.5 .5 .5], [1 .5 .2]))
 
sub-sid001567_task-pinel_acq-s1p2_run-03_bold_full_design_matrix.png

Step 6 (optional). Save the Preprocessed Data

Store the denoised fmri_data object and any relevant nuisance matrices for subsequent analyses:
% Save the fmri_data object
% obj_denoised.save('participant_denoised.mat');
 
% OR, save the file in the parent folder using the filename root:
[dd, ff, ee] = fileparts(obj_denoised.fullpath(1, :));
[~, fn] = fileparts(ff);
fn = [fn '_denoised.mat'];
save(fullfile(dd, fn), 'obj_denoised');
This file can be loaded later for connectivity analyses or model fitting.

Step 7. Analysis: Connectivity and Custom RL Models

Once you have the cleaned data, you can proceed with various analyses:
A. Connectivity Analysis
1. Extract Regional Time Series:Use functions such as extract_data (or the CANLAB-supported brainpathway tools) to get time series from regions of interest (ROIs).% Example: extract time series for a specific ROI
roiMask = 'path/to/roi_mask.nii';
roiTS = obj_denoised.extract_data(roiMask);
2. Compute Connectivity Metrics:You can calculate correlation matrices, graph metrics, or other connectivity measures from the extracted time series.
See canlab_connectivity_predict()
B. Custom Reinforcement Learning (RL) Models
1. Prepare the Data for Modeling:Use the denoised voxel or ROI time series as inputs to your RL model.For instance, you might extract trial-by-trial signals aligned to task events.
2. Fit Your RL Model:Implement your RL model (e.g., using MATLAB’s optimization or Bayesian tools). You may code the model in MATLAB or interface with Python (e.g., via MATLAB’s Engine API).
% Pseudocode example for model fitting
modelParams = fitRLModel(roiTS, taskEvents);
3. Evaluate Model Performance:Analyze the model parameters, compare with behavioral data, or run statistical tests (e.g., using fitlme, igls, or CANLAB’s fmri_data.regress for second-level analysis).

Summary

  1. Data Loading:Read the 4-D NIfTI into an fmri_data object.
  2. Nuisance Modeling:Build a nuisance regressor matrix using intercepts, motion, CSF, spike, high displacement, and HPF regressors.
  3. Denoising:Regress out the nuisance signals to create a cleaned dataset.
  4. Saving:Save the denoised data and nuisance matrices.
  5. Analyses:
By following these steps and using the CANLAB toolset, you can efficiently pre-process your fMRI data and set the stage for advanced connectivity and model-based analyses. Happy analyzing!